#Arm alarm when not at home

1 messages · Page 1 of 1 (latest)

spring elm
#

I would like for HASS to arm alarm when i turn location on and I'm not at home, tried the following but it didn't work:

alias: Testing
description: ""
triggers:

  • trigger: template
    value_template: |
    {{ not is_state('person severcki','home') }}
    for:
    hours: 0
    minutes: 2
    seconds: 0
    conditions: []
    actions:
  • action: alarmo.arm
    metadata: {}
    data:
    mode: away
    skip_delay: false
    force: false
    entity_id: alarm_control_panel.alarmo
    code: "xxxx"
    mode: single
coral questBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

half juniper
#
  1. You could just use not_to: 'home' in a state trigger
  2. What does the trace tell you?
spring elm
#

Let me try your suggestion, though i think i tried something already. When i put run on the automation it did run the "action" part. Just a sec that I try

#
description: ""
triggers:
  - trigger: state
    entity_id:
      - person.severcki
    not_to: home
conditions: []
actions:
  - action: alarmo.arm
    data:
      mode: away
      skip_delay: false
      force: false
      entity_id: alarm_control_panel.alarmo
      code: "xxxx"
mode: single
#

It didn't fire from itself

#

When i manually triggered it went ok

#

I also tried numeric state and also didn't work

half juniper
#

And person.severcki becomes something other than home?

spring elm
#

Person severcki is currently not_home

#

That is its state in the developer tab

#

From midnight it was away because i turned off the phone gps.

#

Because of it accidentally arming the alarm due to inaccurate gps position inside of the house

#

And then when i turned the gps back on at work it didn't arm the alarm due to the fact that it requires "leaving" in the zone automation

#

Now I would like to remedy such a situation with a new automation

#

@half juniper ∆

half juniper
#

Right, it has to become that after you wrote the automation

spring elm
#

Aha so it needs to switch state

#

Ok got it. Lol, i did like 5 variations

#

So probably this automation should work?

#

Thanks, i didn't realise the action wouldn't be seen immediately. How to i make it check the relevant state more often?

#

@half juniper

#

Is it a time pattern trigger? And then state condition and then action

half juniper
#

Normally you just want a state trigger, that's all you need

#

Then it'll trigger when you leave

#

You can test easily though

coral questBOT
#

To test an automation there's three stages you can follow. Testing the action, the condition and action, and the whole automation:

  1. Use Configuration -> Automations to find the automation and then select Run in the three dots menu. If this fails your problem is in the action: section, and details should be found in your log file
  2. Use Developer tools -> Services and call automation.trigger on the automation with skip_condition: false. If the first passes but this fails then the problem is in your condition: block
  3. Use Developer tools -> States to find the trigger entity, click the name, then change the state (at the top) to something that'll trigger the automation before pushing Set State. If this fails then the problem is with your trigger: section, or the automation is turned off (you can check that in Automations, automations that are turned off will show Disabled)

You can also see this section in the docs about testing and automation traces.

spring elm
#

But the state trigger leaving didn't cover my case when i had the gps turned off and i turned it on in a different area as to my zone

half juniper
#

It should, since the state will change

#

The only reason it won't is if it was already not_home when you wrote the automation

spring elm
#
description: ""
triggers:
  - trigger: zone
    entity_id: device_tracker.vog_l29
    zone: zone.home
    event: leave
conditions: []
actions:
  - action: alarmo.arm
    data:
      mode: away
      skip_delay: false
      force: false
      entity_id: alarm_control_panel.alarmo```
#

This was my original automation

#

without the code and the single part

#

Aha i see it was because it had the "zone" trigger? Right?

half juniper
#

Yes