#Need help with template for when everyone leaves home

1 messages · Page 1 of 1 (latest)

charred plank
#

I've been trying to create a template so when my girlfriend and I are both away, various things will happen (lights off, vacuum runs, etc). I've actually got most things working, except one major issue. If just one of us leaves, it triggers the automation. I tried to create a template based off what I've seen online, but no matter what I do, if one of leaves the house, then it triggers "away". What am I doing wrong with my template? I only want it to switch to away if both of us are away.

{% if is_state("person.suzanne",'home') and is_state("person.joshflix",'home') %}
home
{% else %}
away
{% endif %}

#

Also if there is an easier way to determine if no one is home based on location, I'm all ears. Thanks in advance for your help!

rare pebble
#

Hi @charred plank,
The entity zone.home contains the number of people that are in that zone. If it's 0, either the phones are off or no one is home.