Hey,
I can’t get following automation running.
My goal is to switch the light(s) off, when the last person is leaving home.
Where is my mistake?
I’m obviously new to home assistant.
Thanks for your help
alias: A home
description: ""
trigger:
- platform: state
entity_id:
- zone.home
attribute: persons
to: "0"
condition: []
action:
- type: turn_off
device_id: c42cb2d01fc76b5a75004bb76d8581bf
entity_id: 9d6e28842c4e8b80882b334b60d54fe8
domain: light
mode: single
Remove the attibute: persons line. That contans names. You need to test (the state of) zone.home itself. That holds is a person count.
Another tip: stay away from device actions. They tend to break causing much work. Use service light.turn_on instead.
The way to find out these things is to go to the developer tools, states tab and look up the entity. There you can see the state and all the attributes with their values. Seems like I’m not there