Skip to content

Instantly share code, notes, and snippets.

@jlpouffier
Last active August 5, 2023 20:42
Show Gist options
  • Save jlpouffier/da718f724417629e4f2d27904dcc4681 to your computer and use it in GitHub Desktop.
Save jlpouffier/da718f724417629e4f2d27904dcc4681 to your computer and use it in GitHub Desktop.
Home Assistant Hot Tip of the day: home occupancy
# This condition will be true if your home is empty
condition:
- condition: state
entity_id: zone.home
state: "0"
# This condition will be true if your home is occupied
condition:
- condition: numeric_state
entity_id: zone.home
above: "0"
# This condition will be true if your home is full (all persons are present)
condition:
- condition: template
value_template: "{{states('zone.home')|int == expand(states.person)|list|count}}"
#This will be triggered when your home becomes empty
trigger:
- platform: state
entity_id: zone.home
to: "0"
# This will be triggered when your home becomes occupied
trigger:
- platform: state
entity_id: zone.home
from: "0"
to: "1"
# This will be triggered when your home becomes full (all persons are present)
trigger:
- platform: template
value_template: "{{states('zone.home')|int == expand(states.person)|list|count}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment