I’m trying to understand the best way to write this automation:
When both people leave home turn lights off - that works fine.
But when one person returns it checks for the other not being home and then does other actions. This works fine too.
What I’m seeing is when we both go out, and both come back the automation doesn’t run. I’ve made two versions of this with one person coming home checking for the other and for the copy it’s visa versa. I assumed one person would check in first and the other had not yet so it would run.
Is there a smarter single automation to achieve this?
If you’d shared the code we could possibly have helped more
Typically here I’d put the device trackers (or person entities) in a group and use the state of the group. That will be home if either of you are home, and not_home when both of you are away (not_home).
The automation will only run if nobody is home, and then somebody comes home. It won’t run if somebody is already home. That’s what you said you wanted.
Set logger's default to info and then after the automation runs check the log file. You’ll see information about it triggering, the conditions, and any errors from the actions.