I’ve been trying to troubleshoot this the entire weekend and I can’t figure out the issue for the life of me, any help would be appreciated.
Expected behavior:
When alarm changes to Pending (Alarmo 30sec Entry Delay) - Pulse Lights Yellow
When alarm changes to Triggered - Pulse Lights Red
When alarm is Disarmed - Turn lights to ‘normal’ (100% brightness, 3k Kelvin for 2min, then turn off)
Problem:
Automation works when alarm is pending (lights yellow ), it works when alarm changes to triggered (lights red ). It does not work if alarm if pending and I disarm it, i.e. changing from pending to disarmed. ()
description: Turn on hallway lights based on defined conditions
mode: restart
trigger:
- platform: state
entity_id:
- alarm_control_panel.alarmo
to: pending
id: alarm-is-pending
- platform: state
entity_id:
- alarm_control_panel.alarmo
to: triggered
id: alarm-is-triggered
- platform: state
entity_id:
- alarm_control_panel.alarmo
to: disarmed
id: alarm-is-disarmed
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- alarm-is-pending
sequence:
- alias: Repeat Pulse Hallway Yellow until Alarmo Triggered
repeat:
sequence:
- service: script.turn_on
metadata: {}
data: {}
target:
entity_id: script.lights_flash_yellow
until:
- condition: state
entity_id: alarm_control_panel.alarmo
state: disarmed
enabled: true
- condition: state
entity_id: alarm_control_panel.alarmo
state: triggered
enabled: true
- conditions:
- condition: trigger
id:
- alarm-is-triggered
sequence:
- alias: Repeat Pulse Hallway Red until Alarmo Disarmed
repeat:
sequence:
- service: script.turn_on
metadata: {}
data: {}
target:
entity_id: script.lights_flash_red
until:
- condition: state
entity_id: alarm_control_panel.alarmo
state: disarmed
enabled: true
- conditions:
- condition: trigger
id:
- alarm-is-disarmed
sequence:
- service: script.turn_on
metadata: {}
data: {}
target:
entity_id: script.lights_hallway_presence
Hi, @Didgeridrew, all triggers fire as expected. But on changing (from pending) to disarmed, the lights don’t change from yellow to to ‘normal’. Or rather they do for less than a second and return to the yellow state. It seems that somehow the yellow script assigned to the pending state is being put above in the priority level.
I recorded a video - link - (a bit blurry, apologies) to show what I mean. You can see in the very end after scanning the nfc tag (i.e. disarming the alarm) the bulb initially changes to the expected state (brightness 100%) and then goes back to a yellow lower brightness state that is not present in the automation. I can’t understand why it’s doing that.
You want to look at the trace timeline tab. There’s a dropdown at the top that should show a time entry each time the automation is triggered. You can do the same for your scripts.
What does the script for flashing the light yellow look like? My assumption is that you have a small race condition going. The automation runs the script to turn the light white, but your yellow script gets part way through a run right after (thus turning the light back yellow) before being stopped.
So here’s a strange thing. I’ve tried running the automation about 10 more times. Of those, maybe 3/4 times it ran as expected, the others had the same issue as described above. Note that I changed absolutely nothing between those tests.
Below examples of when it ran as expected and not as expected (nothing seems different).
So, this reads to me like both the ‘white’ and ‘yellow’ scripts changed the light color within the same second (so a race condition). I’d edit option 3 and add an action before the ‘white’ script to turn off the other two (script.turn_off). Ideally, this will make sure they are no longer running before turning the light back to white.
is it possible for you to share the yaml coding for the blinking of lights for arming, disarming and arming? id be very interested into the route you chose for this alarm setup