Last Updated or created 2024-01-31
Config for mqtt-433 and home assistant entities.
Maybe I’ll add a display to select which dimmer to change.
ESPHome Config for direct communication to a MQTT enabled 443mhz dimmer.
When using GND to the rotary you have to use a pullup entry in your yaml
esphome:
name: rotarywhite
friendly_name: RotaryWhite
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="
ota:
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rotarywhite Fallback Hotspot"
password: "xxxxxxxxxxxxxxxxxxx"
captive_portal:
sensor:
- platform: rotary_encoder
name: "WhiteRotaryEncoder"
id: rotvalue
min_value: 0
max_value: 50
resolution: 1
pin_a:
number: GPIO0
inverted: true
mode:
input: true
pullup: true
pin_b:
number: GPIO2
inverted: true
mode:
input: true
pullup: true
on_value:
- mqtt.publish:
topic: "ha433/Living5Spots/brightcontrol"
payload: !lambda |-
return to_string(id(rotvalue).state);
mqtt:
discovery: false
broker: 192.168.1.1
port: 1883
discovery_prefix: homeassistant
Config part to change Home Assistant entities.
WARNING YOU HAVE TO CHANGE RIGHTS!
Settings > Addons > EspHome > Configuration
(press configure to change service calls)

sensor:
- platform: rotary_encoder
name: "WhiteRotaryEncoder"
id: rotvalue
min_value: 0
max_value: 50
resolution: 1
pin_a:
number: GPIO0
inverted: true
mode:
input: true
pullup: true
pin_b:
number: GPIO2
inverted: true
mode:
input: true
pullup: true
on_value:
- homeassistant.service:
service: light.turn_on
data_template:
entity_id: light.bedroomdimmer
brightness: "{{ brightness_1 | int }}"
variables:
brightness_1: !lambda 'return id(rotvalue).state * 4;'
