Arm when Away

I’m trying to create an automation that arms the house when my wife and I are away from the house. I have a Vivint Alarm system and both my wife and I’s phones are configured in HA to show our status. Here is what I got so far:

alias: Armed Away Prompt
description: "Prompt to "
trigger:
  - platform: state
    entity_id:
      - alarm_control_panel.johnny_velasquez_s_house
    to: disarmed
    from: disarmed
condition:
  - condition: state
    entity_id: device_tracker.wifeys_phone
    state: not_home
  - condition: or
    conditions:
      - condition: state
        entity_id: device_tracker.pixel_fold
        state: not_home
      - condition: state
        entity_id: device_tracker.pixel_fold
        state: Work
action:
  - action: script.arm_away
    metadata: {}
    data: {}
mode: single

Seems like it will execute the script whether my wife is home or away. I’m also not sure about the Alarm status. I put from Disarmed to Disarmed because I do not know how to set it to check the current state.

please post code using the code formatting option. since spaces are significant in yaml, its hard for us to read without it.

here’s quick info on it:

for your automation, i think you’re mixing up triggers and conditions (but not 100% positive w/o the right formatting).
you have a trigger for the alarm going to disarmed from disarmed. so that won’t ever fire. what are you trying to do with that.

and i think you have in conditions what you should have as your trigger…
the trigger you need to have is when your wife and your locations are both not home (you’re defining as not_home and Work… but you could also define them as not home.

this post should help clarify:

1 Like

I would add that before you enable this monitor that the presence tracking is 100%, not fun with an alarm arming while you are home. An an actionable notification is what I use.

1 Like

Apologies for not formatting correctly. I have modified OG post.

So this is my goal, when my wife and I are not at home I would like a script send a notification to my phone allowing me to arm the house. I have the script working I just need help with the automation part. My goal is to have the script notification sent whenever my wife and I are away from the house.

I understand about the conditions and triggers being mixed up but I believe I did have it the other way but in the triggers I may need assistance in figuring out the “AND” part. I see when I add both entities it says “OR”.

Appreciate all the assistance. Only been working on HA for a few weeks but very interesting how it works.

Create a person group containing your and your wife’s device trackers. When either (or both) of you is home, the group state will be Home. When you’re both away (not_home), the group state will be away.

Otherwise if you don’t want to bother with that, use a numeric_state trigger with the state of zone.home being below 1

agree w/ shadowfist, i’d do this:

trigger:
  - platform: numeric_state
    entity_id:
      - zone.hom
    below: 1
condition: []
action:
  - action: script.arm_away

he also suggested a person group, but i didn’t know there was a group type that accepted person.

Thank you all for the suggestion. I used a combination of the recommended solutions to solve the issue. I used mine and my wife’s location away as the trigger and in the conditions I made it so that we both had to be away for the script to be run. I left to work and when my wife left later the notification was sent to myself.

Thanks again,

2 Likes

Not sure if it’s supported in the UI, but it’s still supported in yaml so far Group - Home Assistant