Automation for when first person comes home

can someone check this automation to see if i have it set correctly?
the intention is that it should only run when the first person returns home after there being no-one at home.

it should also account for the case where 2 people return home at the same time after there being no-one a home (there are only 2 HA “people”)

alias: When first person arrives home
description: Automation that turns on all required devices when first person arrives home
triggers:
  - alias: When first person arrives home
    trigger: numeric_state
    entity_id:
      - zone.home
    above: 0
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: 21
    target:
      entity_id:
        - climate.bedroom
        - climate.living_room
    alias: Set temperature in bedroom and living room to 21 degrees
  - type: turn_on
    device_id: c366ceaef0c95a2e4d8c98d5255f18fc
    entity_id: 4ed714acbd203f1e9eeb1057be1d9922
    domain: switch
    alias: Turn on bedroom de-humidifier
  - action: notify.mobile_app_simons_iphone
    metadata: {}
    data:
      message: test someone is home
      title: My Home
    alias: Send notification to Simons phone
mode: single

You could switch the automation off at the end.

There’s no need to do that.

Yes this trigger is exactly what you want.

It will only trigger when there is no one home and either one or two people arrive home. It will not trigger when one person is already home and then the second arrives.

cool, i was concerned that it might also trigger when changing from 1 to 2, and not just from 0 to 1.

it was the above: 0 that made me wonder

It only triggers when the trigger criteria changes. Once above zero, it has to go back to zero then above again to re-trigger.

2 Likes