Hi everyone, long time home assistant tinkerer, new to esphome.
I’m 99% this is just a formatting/ YAML issue on my part but I cannot get it to work for the life of me.
I have a rotary encoder hooked to a D1 mini.
The following code works exactly as intended:
sensor:
- platform: rotary_encoder
name: "Rotary Encoder"
pin_a: D3
pin_b: D2
on_clockwise:
- logger.log: "Turned Clockwise"
on_anticlockwise:
- logger.log: "Turned Anticlockwise"
This shows events being logged so I know the hardware and basic config are working.
If I call the service below in developer tools it works as expected:
service: light.turn_on
data:
brightness_step_pct: 10
target:
entity_id: light.office
So far so good.
But if I try to put it all together like this it doesn’t work:
sensor:
- platform: rotary_encoder
name: "Rotary Encoder"
pin_a: D3
pin_b: D2
on_clockwise:
- logger.log: "Turned Clockwise"
- homeassistant.service:
service: light.turn_on
data:
brightness_step_pct: 10
target:
entity_id: light.office
The editor in HA doesn’t show any error but when I try to upload it I get the following message:
mapping values are not allowed here
in “/config/esphome/esphome-test-1.yaml”, line 86, column 15:
data:
^
I’ve googled the error and not got anywhere, if anyone can point me in the right direction I’d be very grateful.