Using Home persons numeric state

I am trying to use the numeric state of the home zone number of persons to run an automation when anyone of my persons returns to the house. According to the logbook the number of persons in the zone updates correctly but the automation is not triggered. Any help appreciated.

alias: Unlock House
trigger:
  - platform: numeric_state
    entity_id: zone.home
    attribute: persons
    above: 0
condition: []
action:
  - device_id: ""
    domain: lock
    entity_id: lock.side_entrance
    type: unlock

We would probably need to see the automation unless you think we have magic. :wink:

EDIT Thanks. :slight_smile:

Just added. Sorry

Why are you using the attribute persons? It should simply be:

  - platform: numeric_state
    entity_id: zone.home
    above: "0"

Persons attribute is a list of entities. Not a numeric value.

2 Likes

I promise I did try it with and without but I must have had something else wrong. Removed attribute this time and it did work! Thanks. alot.

One more quick question on this. It seems like the trigger only hits when the count transitions from 0 to above 0. Is there a way to have it trigger on any change?

Yes you can use a state trigger. Are you looking to have it trigger even on zero?

This will trigger on ANY changes to the state. Notice the to is null.

  - platform: state
    entity_id:
      - zone.home
    to:

This will trigger on any changes except zero.

  - platform: state
    entity_id:
      - zone.home
    not_to: "0"

Thanks I will try that!