Currently I’m using the toggle functionality in automations. I was wondering if there was a way I could improve below, so that when off/0 is received, the lights will trigger off (if they were on), and vice versa.
Basically the problem I’m trying to solve is that sometimes one light will be on, while the other will be off. If I press the button, they will switch roles with the other now on, and the other light off!
- alias: 'ESP Button Lights'
trigger:
- platform: state
entity_id: binary_sensor.matt_lights
to: 'on'
- platform: state
entity_id: binary_sensor.matt_lights
to: 'off'
action:
service: switch.toggle
entity_id:
- switch.matts_bed_lamp
- switch.matts_desk_light