I can’t get this automation working. I have a shelly switch and the aqara motion sensor. I think its something to do with the YAML as the switch and sensor work independently. Any ideas. Photos attached.
I wrote the script written but when I saved it changed automatically.
Script in at the moment is
triggers:
- entity_id: binary_sensor.0x54ef441000b6309c_occupancy
to: "on"
trigger: state
- entity_id: binary_sensor.0x54ef441000b6309c_occupancy
to: "off"
for:
minutes: 2
trigger: state
actions:
- target:
entity_id: switch.en_suite_light_switch_0
action: light.turn_{{ trigger.to_state.state }}
mode: single
Also, I would advice you to give your devices/entities a much more meaningful name then
0x54ef441000b6309c to make things easier to recognize/read/troubleshoot.