Looking to exit an automation mid-way with a piezo buzzer?

Hello,

I have a konnected board as my home alarm system and I could use some assistance
setting up some automations for the piezo buzzer. I’m using the Manual Control Panel

I’m sure I’ve absolutely butchered some of the automation below, development is not my profession and I’m about 2 weeks into setting this up though having a lot of fun with it. :slight_smile:
I’m running v. 0.94.4

Presently, there are 2 ways to activate the alarm:

  1. arm_home= I put in my PIN, press arm_home and it arms the alarm instantly. Useful when you’re going to sleep
  2. arm_away = I put in my PIN, press arm_away and it arms the alarm after 60 seconds, so you have 60 seconds to leave the house.
    During these 60 seconds, the state of the alarm is ‘pending’, after 60 seconds, it changes to ‘arm_away’

So once I punch in my PIN on my keypad and press ‘arm_away’, the following things happen:
1- I have a visual timer that kicks in and counts down 60 seconds
2- Alexa TTS says “Perimeter defenses online in 60 seconds”
3- The piezo buzzer beeps once per second for 50 seconds,
4- The piezo buzzer beeps 3 times per second for the last 10 seconds (to express a sense of urgency to exit the house)

The issue I’m experiencing is that if I set ‘arm_away’ to trigger the automation but decide within 60 seconds to disarm the system, the piezo buzzer continues to beep down to the entire 60 seconds (step #3 & #4) even though the system has now been disarmed.

I have another automation that does the following when I ‘disarm’ the system:
1- The timer is canceled
2- The piezo buzzer 50 second switch turns off
3- The piezo buzzer 10 second switch turns off
4- The siren stops if it got triggered
5- Alexa TTS says “Perimeter defenses, offline”

So sequence 1 and 5 happen (I’m assuming #4 also does but haven’t tested it yet) but 2 and 3 don’t. I was hoping steps 2 and 3 would exit the other automation but doesn’t seem like it’s working.

Essentially, I’m looking for a way to exit the automation once the state of the alarm has changed from ‘pending’ to ‘disarmed’

I tried replacing switch.turn_off with homeassistant.turn_off but that did not work.
I also tried creating a new piezo buzzer countdown (that only runs for 10 ms then stops) to see if I could somehow ‘override’ the other countdown, but that also did not work.

The 2 automations I mentioned above are below:

Disarmed Automation:

#################################################
# When the alarm has been disarmed. The following things happen:
# 1- Timer is canceled
# 2- Piezo 50 second countdown stops (not working)
# 3- Piezo 10 second countdown stops (not working)
# 4- The siren turns off
# 5- Alexa says "Perimeter defenses, offline"
#################################################
- alias: Alarm Disarmed
  trigger:
    - platform: state
      entity_id: alarm_control_panel.alarm
      to: disarmed
  action:
    - service: timer.cancel
      entity_id: timer.arm_away_timer
    - service: switch.turn_off
      entity_id: switch.countdown_50
    - service: switch.turn_off
      entity_id: switch.countdown_10
    - service: switch.turn_off
      entity_id: switch.siren_2
    - service: media_player.alexa_tts
      data:
        entity_id: media_player.my_echo_dot
        message: "Perimeter defenses, de-activated"
#################################################
#################################################

Arm_away automation:

#################################################
# When the alarm has been set to Arm_away, you have 60 seconds to
# leave the house. This happens:
# 1- Alexa will say you have 60 seconds
# 2- Countdown timer will start 
# 3- Piezo buzzer will start the 50 second countdown
# 4- Piezo buzzer will start the 10 second countdown
#################################################
- alias: Arm Away
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.alarm
      from: disarmed
      to: pending
  action:
    - service: media_player.alexa_tts
      data:
        entity_id: media_player.my_echo_dot
        message: "Perimeter defenses will activate in 60 seconds"
    - service: timer.start
      entity_id: timer.arm_away_timer
    - service: switch.turn_on
      entity_id: switch.countdown_50
    - delay: 00:00:50
    - service: switch.turn_on
      entity_id: switch.countdown_10
#################################################
#################################################

Thank you in advance!

1 Like

I don’t see anything in the automation that would cause the action of turning off switch.countdown_50 to fail.

If you use the Services page to call services switch.turn_on and switch.turn_off for switch.countdown_50, does it work for both services?

What is the configuration for switch.countdown_50?

Thanks for the reply!
In Services I ran switch.turn_on switch.countdown_50 and hear the beeps, then issue the switch.turn_offswitch.countdown_50 but it continues to beep.

While in Services- The one odd behavior I kind of noticed was that while switch.turn_on was running, if I issued the switch.turn_off command like 3 times in a row, it would pause a beep but then would continue on again.

Here is the config

        - zone: 1
          name: Countdown_10
          momentary: 100
          pause: 55
          repeat: 50
        - zone: 1
          name: Countdown_50
          momentary: 1000
          pause: 1000
          repeat: 25

Pardon my ignorance but I don’t recognize the Home Assistant parameters you are using (zone, momentary, pause, etc) to configure the two switches. Which platform is being used for these switches?


EDIT

Is it the Konnected switch platform?

Based on your testing via the Services page, it doesn’t appear they respond correctly/promptly to the switch.turn_off service. That’s a problem in itself and, until resolved, will continue to plague your automation.

Yes, this is the Konnected switch platform! Thank you for your help even though you’re no familiar with the system!

I guess the next step is to reach out to the konnected team and have them fix this? Not really sure how to proceed from here.

I did a quick search of the community forum (you may wish to do a more thorough one) but didn’t find posts mentioning the problem you’re experiencing. The next step would be to post an Issue in Home Assistant’s Github repository.