State changes as automation runs - how to save state?

I’m trying to set up an automation that switches on a light when a door is opened, when the alarm is “Armed away”.

The problem is, the act of opening the door changes the alarm state from “Armed Away” to “Pending”, until the user code is input and it changes to “Disarmed”.

So the light doesn’t turn on as I wanted.

This is a real world example of me disarming the alarm with timestamps:

Alarm is Armed away
20:11:43 - 21 hours ago

Door was opened
11:07:15 - 7 hours ago

Alarm changed to Pending
11:07:15 - 7 hours ago  (Happens same time as door is opened)

>changed to Disarmed (User code accepted)
11:07:26 - 7 hours ago

A solution I can see is to save only the “Armed Home” and “Disarmed” states (ignoring “Pending”) and use that in the automation.

Would I use a helper for that?

Any help would be appreciated :slight_smile:

So … you know opening the door changes the alarm state to Pending. Why not change the automation to check for Pending?

1 Like

As @jeffcrum states why not have the door opening as the trigger with and OR condition of alarm state = armed_away OR pending.

1 Like

Apologies for the delay replying!

Well, I assumed the “Pending” was something HA put in there to be honest, maybe I’m wrong. In that case yes what you said would work.