#best way to detect when everyone leaves home

1 messages · Page 1 of 1 (latest)

bronze pier
#

??

real light
#

Make a group "is anyone home” and then automation on “when group entity goes off” meanijg nobody is home

mossy whale
#

zone.home = 0

bronze pier
#

well wont it all break when they disconnect from the wifi?

mossy whale
#

So would any other device you connect with. It doesn't have to be a phone.

final blade
#

I'm using the zone and it works pretty well. I think it's all GPS for the areas so wifi shouldn't be an issue.

spare tundra
#

well, it's using whatever device tracker entities you have set up. those can be the home assistant app on a phone (uses gps) or one of a variety of other options.

#

if you want to detect when everyone leaves home, first you need a reliable way to tell whether everyone is at home or not :)

devout tangle
#

I have the companion app loaded on everyone's phone with location tracking on. I have defined an area around my house as "Home". My automation triggers when anyone changes from Home to Away... but with the condition that it only runs if everyone is showing as Away. Works perfect.

#

Here is the YAML for my automation. The last part triggering a toggle is used for my automation that then runs when the first person returns to the house (and turns on lights in the kitchen and family room).

description: ""
triggers:
  - trigger: state
    entity_id:
      - person.ryan
    from:
      - home
    to:
      - not_home
  - trigger: state
    entity_id:
      - person.dawn
    from:
      - home
    to:
      - not_home
  - trigger: state
    entity_id:
      - person.jared
    from:
      - home
    to:
      - not_home
conditions:
  - condition: state
    entity_id: person.ryan
    state:
      - not_home
  - condition: state
    entity_id: person.dawn
    state:
      - not_home
  - condition: state
    entity_id: person.jared
    state:
      - not_home
  - condition: state
    state:
      - "off"
    entity_id: input_boolean.guest_mode
actions:
  - action: light.turn_off
    data: {}
    target:
      entity_id:
        - light.family_room_lights
        - light.kitchen_lights
        - light.sunroom_lights
        - light.bedroom
        - light.logan_s_light
        - light.basement
  - action: input_boolean.turn_off
    target:
      entity_id: input_boolean.logans_nightlight_toggle
    data: {}
  - action: input_boolean.turn_on
    target:
      entity_id: input_boolean.house_empty_toggle
    data: {}
mode: single
real light
# devout tangle Here is the YAML for my automation. The last part triggering a toggle is used f...

Your automation could be changed to this:

triggers:
  - trigger: state
    entity_id: zone.home
  - trigger: homeassistant
    event: start
conditions:
  - condition: state
    entity_id: zone.home
    state: '0'
  - condition: state
    state:
      - "off"
    entity_id: input_boolean.guest_mode

The entity zone.home holds number of people that are in the zone. So when it goes to zero, you could perform the activity and when the guest mode is off, too. Optionally, you can add the home assistant start event to ensure the state is valid after reset in case something goes sideways when you leave.

#

And if you have defined more zones, each zone has an entitiy zone.zone_name and its state is the number of people in the zone (or tracking devices, better to say).