Trigger within X amount of time

Hello HA community,

I recently started learning HA and I’m simply in love with it.
I’ve been setting some automations but I am struggling with a specific setup

I have 2 door sensors installed and I want to create the following automation.

When “door 1” has been opened and “door 2” opens within 60 seconds of “door 1” being opened, Do something.

Can this be created using the GUI or is coding required here? for both cases any tips on where to look?

Thanks for your time :3

1 Like

Trigger on door 1 opening then use a wait for trigger for door 2 as your first action.

The wait should be set to timeout in 60 seconds and not continue on timeout.

I have no idea if this can be done fromthe GUI as I don’t use it.

Found it, ty!

Just a heads up, it may be advisable from the beginning to change your trigger from “device” to ‘state” trigger.

Your can check the state in developer tools section, but most door sensors are either in a state of ‘on’ or ‘off’ rather than the expected open or closed for example.

The reason for this is over time you may wish to change the door sensor, replace it, move it somewhere else etc and the device ID would change and mess up any automations and or scripts that reference to it, were as if you were to reference to the state of the entity_id instead then even completely changing the device you could simply edit the new sensors entity_id and none of your automations or scripts would be affected.

PS: you can easily change entity_id but not the device ID

1 Like