Manual Alarm Disarm Automation

Hello,
I’m setting up the manual alarm, and I’m running into some trouble with an automation to turn off (disarm) the alarm.

I have a little test setup consisting of the konnected board and a smart switch (smart switch will be replaced with my actual siren once I have the bugs worked out :slight_smile:) . The smart switch is turned on by an automation when any of my motion or door sensors trip the alarm.

Now I want to turn off the smart switch when I disarm the alarm - e.g. I accidentally open the door when the alarm is on, and I want to disarm it quickly to turn off the smart switch.

Here is my disarm automation that is not working:

- alias: Alarm Disarmed
    trigger:
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'armed_home'
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'armed_away'
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'disarmed'
    action:
      - service: switch.turn_off
        entity_id: switch.garage_pz

The above automation works if I set the alarm to armed_home or armed_away, but not disarmed. I looked through the home assistant constants source code, and disarmed is a valid state, so I don’t know what I’m doing wrong. Any thoughts?

Hi,

Instead of ‘disarmed’, can you try ‘alarm_disarm’. That’s what one of my script says.

Gave that a shot, but no luck unfortunately…

So, I got it working… I moved disarmed to the first trigger, and now it works… Moved it back to the bottom, and it still works. Something must have been cached or something similar. I did try restarting hass several times, along with manually reloading the automations (configuration > general > reload automations), but it didn’t work.

Well, I’m happy!

Leaving the “final” test code here in case it helps anyone else.

- alias: Alarm Disarmed
    trigger:
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'disarmed'
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'armed_home'
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'armed_away'
    action:
      - service: switch.turn_off
        entity_id: switch.garage_pz