Zone based automation not working?

I have this zone based automation to disarm the house alarm as we enter a zone, I have 3 home zones defined, home, home-medium, home-extended.

- id: '1724303698147'
  alias: Disarm Alarm - Zone
  description: ''
  trigger:
  - platform: zone
    entity_id: person
    zone: zone.home
    event: enter
  - platform: zone
    entity_id: person
    zone: zone.home
    event: enter
  - platform: state
    entity_id:
    - device_tracker.c3po
    to: home
  - platform: state
    entity_id:
    - device_tracker.r2_d2
    to: home
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: enters
    zone: zone.home_medium
    id: home_extended
  - platform: device
    device_id: 6973a6f6f1822b04887ea8dd8b131f08
    domain: device_tracker
    entity_id: 83e1ead38e20ca4407d44b37cf2b63cc
    type: enters
    zone: zone.home_medium
  condition:
  - condition: state
    entity_id: zone.home
    attribute: persons
    state: '0'
  - condition: state
    entity_id: alarm_control_panel.alarm
    state: armed_away
  action:
  - action: alarm_control_panel.alarm_disarm
    metadata: {}
    data:
      code: '****'
    target:
      device_id: 983405354c0e85085d81f56eae591a00
  - action: notify.all_mobile_notifications
    metadata: {}
    data:
      title: House alarm
      message: House disarmed
  mode: single

This automation never triggers or anything, I ran it manually and it worked but when we enter the home-medium zone it doesn’t work but I have another automation that tells me when someone enters or leaves the zone and send a notification and that automation works perfectly, everytime I or someone enters/leaves a zone, I get a notification. so I know that homeassistant is getting zone updates, I’m just confused as to why this automation doesn’t work.

entity_id: person is definitely wrong. You need to define the actual person entities or put them in a group, in which case your entity will be group.something

Alternatively, zone also has a numeric state which is more flexible. Change all your triggers so that numeric state is greater than 0 and you won’t have to bother with maintaining persons in the automation.

Tip 1. Try to avoid using device triggers for your automations.

Tip 2. You haven’t provided the automation which you say works fine so we can compare, therefore all this is just a guess.

I removed the person name for privacy haha but in the automation it actually is set by person.PERSON_NAME.

- id: '1724004605574'
  alias: zone notifs
  description: ''
  trigger:
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: enters
    zone: zone.home_extended
    id: vib_home_extended
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: leaves
    id: vib_home_extended_leave
    zone: zone.home_extended
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: enters
    zone: zone.home_medium
    id: vib_home_medium
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: leaves
    id: vib_home_medium_leave
    zone: zone.home_extended
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: enters
    zone: zone.home
    id: vib_home
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: leaves
    id: vib_home_leave
    zone: zone.home
  - platform: device
    device_id: 48562e1cf3edcd0e723c0b4ebd8f17ae
    domain: device_tracker
    entity_id: 7611459695261117840cf946380b0607
    type: leaves
    id: vib_left_work
    zone: zone.sterletzia_flower_shop
  condition: []
  action:
  - if:
    - condition: and
      conditions:
      - condition: zone
        entity_id: device_tracker.c3po
        zone: zone.home
      - condition: zone
        entity_id: device_tracker.r2_d2
        zone: zone.home
    then:
    - action: notify.mobile_app_r2_d2
      metadata: {}
      data:
        message: <person> at {{states('device_tracker.r2_d2')}} and <person2> at {{states('device_tracker.c3po')}}
    else:
    - choose:
      - conditions:
        - condition: trigger
          id:
          - vib_home_extended_leave
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: almost home
      - conditions:
        - condition: trigger
          id:
          - vib_home_extended
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: took 113 exit towards home
      - conditions:
        - condition: trigger
          id:
          - vib_home_medium
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: entered roundabout
      - conditions:
        - condition: trigger
          id:
          - vib_home_medium_leave
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: exited roundabout
      - conditions:
        - condition: trigger
          id:
          - vib_home
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: is home
      - conditions:
        - condition: trigger
          id:
          - vib_home_leave
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: left home
      - conditions:
        - condition: trigger
          id:
          - vib_left_work
        sequence:
        - action: notify.mobile_app_r2_d2
          metadata: {}
          data:
            title: <Person>
            message: left work
  mode: single

This is the zone based automation that works and sends me all the notifications for every zone thats exited and entered. I’ll switch it to entity based and see if that works

1 Like