Home zone automation

Hello,
I have what I think is a simple automation…when both people leave, arm alarm. However, it appears that HA is not detecting when we leave zone. We are using companion app on phones for location determination.

Here is the yaml:

id: '1764346291364'
alias: Arm Alarm
description: ''
triggers:
  - trigger: numeric_state
    entity_id:
      - zone.home
    below: 1
conditions: []
actions:
  - action: alarm_control_panel.alarm_arm_away
    metadata: {}
    data: {}
    target:
      entity_id: alarm_control_panel.alarm_control_panel
mode: single

Hello Courtney,

Thanks for coming here and asking a question. Welcome to the Home Assistant Forum.
Would you be so kind as to adjusting the format of your code so that we can read it properly & check the YAML spacing, etc. Editing your original is the preferred way. It is very hard for us to tell what is what when the text formatter jumbles everything like that.
You can use the </> button like this… How to format your code in forum posts
OR… Here is an example of how to fix formatting from the site FAQ Page.
How to help us help you - or How to ask a good question.

Try:

  - trigger: state
    entity_id:
      - zone.home
    to: 0

do I need remote access to HA for this automation to work?

Yes.

If you don’t have this or don’t want it then you can use another detection method instead. Like connection to your Wifi.

I have the wifi sensor in the companion app enabled but guessing that won’t work either without remote access?

Correct. You need something on the Home Assistant side, like ping or nmap.

Thank you for confirming. I wondered if that was my issue as I was pretty confident the logic was correct.

Note, that if you have iPhones - ping will not work reliably, as when the device goes into power saving mode it will stop responding to pings. There is a custom component called iphonedetect that works very reliably.

This needs quotes around the 0, as all states are strings :slight_smile: