When coding automations for the Manual alarm, I’d like to know what the armed state was or will be while in one of the other alarm states (arming, pending, triggered).
For example, when in the “arming” state an automation might want to do something different (or not at all) depending on the armed state that the alarm is transitioning to. But since the alarm state can only have one value at a time I can’t find a way to know what I want to know.
I suppose that once the alarm enters one of the armed states I could set a variable, but that won’t help me in the “arming” state.
You can eliminate one. “Triggered” implies the the alarm was previously “armed”.
If you are using automations you can get the current and previous state using trigger variables, e.g.
trigger:
platform: state
entity_id: alarm.your_alarm
action:
service: persistent_notification.create
data:
message: "Alarm state was {{ trigger.from_state.state }} and is now {{ trigger.to_state.state }} "
Thanks for your reply Tom. I hadn’t considered the trigger.from_state.state.
Unfortunately, the “triggered” state is actually the hardest one of all because the from_state is “pending”. Who knows which armed state it was before “pending” when you are in the “triggered” state.
My solution was to reluctantly create a helper variable that I set when in the armed states and I refer to that when I need to.