Hello to all,
new to esphome, because I’m in the iobroker/ Tasmota World.
With Tasmota there is no easy way to get an rotary encoder to publish via MQTT
I found ESPHome and this looks very nice.
I got an ESP8266, a rotary encoder and a LED. Yes on a Breadboard.
And Here is my yaml:
captive_portal:
web_server:
binary_sensor:
- platform: gpio
name: Button Module
pin:
inverted: true
mode:
input: true
pullup: true
number: GPIO12
id: button_module
sensor:
- platform: rotary_encoder
name: Rotary Encoder Sensor
id: sensor_rotary_encoder_1
pin_a:
number: GPIO14
inverted: true
mode:
input: true
pullup: true
pin_b:
number: GPIO13
inverted: true
mode:
input: true
pullup: true
on_clockwise:
then:
- output.turn_on: output_esp8266_pwm_1
on_anticlockwise:
then:
- output.turn_off: output_esp8266_pwm_1
output:
- platform: esp8266_pwm
id: output_esp8266_pwm_1
pin:
number: GPIO5
In Web Server there is a Button Module that reacts on button press.
Next Step is to publish the Button Press to my iobroker via MQTT.
There is also a Rotary Encoder Sensor which shows State: NA at Power On.
If i turn the rotary clockwise, the state changes to -1. After that any rotation in any direction dosn’t change anything.
My Goal is to:
- Capture everything in iobroker
- Create a script and via the script
- Switch the LED on and off
- Dim the brightness of the LED
Any Help was appreciated. And i try to expand this howto for other People.


