Wait for one of 3 conditions (2x Door Sensor, 1x Time)

For a garage door control i need a flow which waits for one of 3 conditions get true.
push a button and wait until
door sensor 1 is closed
door sensor 2 is closed
counter 2 minutes is expired

the door sensors are already triggering variables.

what is the best way to implement this efficiently.
thank you

Hard to know without more information about your use case, but for the purposes of the suggestion below I’ve assumed:

  • the whole process kicks off when you push a button
  • if at the point when you press the button door sensor 2 is already closed then Homey should do the thing (whatever thing is waiting for one of the 3 conditions)
  • if at the point when you press the button door sensor 2 is not already closed then start a 2 minute timer and whichever occurs first out of (“2 minute timer expires”, “door sensor 1 closes”) causes Homey to do the thing

If that’s what you meant, then the following flow should implement it. If you meant something else then you’re going to need to explain more about what you want to happen.

This flow uses the Chronograph app for the timer. Other timer apps are available.

1 Like

thanks, i describe the use case more in detail:

garage door with an impulse control: open-stop-close-stop-open and so on.
2 door sensors (one for open, one for closed) and a shelly 1 for the impulse.

problem is that if the door is in the middle (manually) both sensors are not active and you dont know which impulse comes next.
so you need to send the impulse and wait until one or the other sensor is acting and if it was the wrong one send another impulse.

the timer would only be for error handling. it is the max time for the full door open / Close action.
So when the timer is expired, one of the 2 sensors should have acted before …

Is it more clear now :slight_smile:

in the meantime i simulated it via a variable: not sure if this will work…(it is german, but should be understandable )

So let’s say instead of a simple push button you have a button capable of sending ON and OFF separately then you are clear on the desired state of the door after you press the button. (If you use a simple push button you’ll need to decide whether to default to open or closed if door is neither when you press it and it seems like a better user experience if you can clearly send open or closed command instead.)

Flow could look like this - you maintain a variable with the desired state of the door - this variable is updated by the button being pressed on or off. When that happens you start a timer and send the impulse. If the door opens when target state is open and the timer is running then you’re done and can stop the timer. Similarly if the door closes when target stats is closed and the timer is running.

If the door either opens when target state is closed or closes when target state is open, then you send another impulse.

Does this work?


Unfortunately it is not possible to have a dedicated on and off button. Most of Garage control work with this kind of impulse button.
But thanks for your suggestion. Time to implement and test.