Try using the debug/tracing functionality in HA for the automation, you can see each decision HA takes when evaluating the conditions in an automation. This should tell you what is going on.
I think I found out why… I was testing the automation using ‘Run Actions’, I assumed that would run the automation from the start, but all it seems to do is run the output.
I manually tested it using the alarm and all worked well!
It’s a shame I can’t test the system another way though
The button is named ‘Run Actions’. It only runs the actions. This is also explained in the documentation: Testing your automation.
You can manually trigger the automation using the automation.trigger service. It doesn’t execute any of the automation triggers but it can optionally execute the condition.
Go to Developer Tools > Services, select your automation and then turn off ‘Skip Conditions’. When you click the Call Service button it will execute the automation’s condition and action.
Be advised that if you create an automation that references the trigger variable in the condition or action then you cannot test it with ‘Run Actions’ or automation.trigger (also explained in the documentation).
Another way to test the automation is to force the trigger. For example, your automation uses a Device Trigger that monitors the state of binary_sensor.alarm_sensor_2_any_3. You can go to Developer Tools > States, select binary_sensor.alarm_sensor_2_any_3 and force its state to a different value (‘off’).
In the following example, the state of binary_sensor.garage is currently on. I can set its state to off by typing off in the State field and then clicking the Set State button. That is sufficient to trigger an automation that’s monitoring the state of binary_sensor.garage.