Flow using door sensor to turn on lights, then back off

I have an Aqara Zigbee door sensor on a storage closet under the stairs that turns the light on upon opening the door. It also turns the light off when the door is closed. However, I would like to have the light turn off if the door is left open, after 7 minutes.

Can I do this within the same flow or should this be handled separately? Not sure exactly how to connect the duration to an off card.

it should work like this Shared Flow | Homey

No, this means that the light will be turned off 7 Minutes after the door is closed.

@jpcams wants to turn off the light if the door stays more than 7 minutes open, right?

It’s possible with the same flow:

2 Likes

Something like this?

And to turn it off when the door closed you make a new flow that triggers de alarm off state of the door sensor.

On the surface this will work, except for one caveat. In the scenario that you open the door, close it, and 6 mins later you open the door again, in this setup I am not sure what the delay of the first trigger does. Might be it sends the off signal within the minute, and again after 7 mins.

Therefore I use Homey delays only for the short and simple ones, and use an app like [App] Chronograph - Adds precise timer, stopwatch and transition functionality to Homey or similar to start actual timers.

Using that you can start the timer when the door opens, and cancel it when you close the door. That way you are sure you won’t be surprised by inexplicable events caused by hidden delays.

With hidden delays I mean that in normal Homey delay operation you cannot see that an action is pending. With the above app you can see any running timers in the app configuration page, so you can see what is going on and debugging is way easier.

2 Likes

In my case case the first timer is deleted or something. I tried it earlier.

In that case you should be fine. If you ever find yourself in a situation with more complex needs: the app also supports things like resetting timers, less than second timers, checking if timers are running, starting a new timer if there isn’t one and keeping it as it if its already running, changing a value gradually over time, measuring time and much more.

@Edwin_D, you’re absolutely right. The delay doesn’t stopp. So in this example the light turns off after 1 Minute, if the door is opened the second time after 6 min (within in the delay time) again.
Don’t know if this behavior depends on the used app, but I guess not. I used the Fibaro app resp. Fibaro devices.
One way the flows might look:

Flow 1 (Open door)
When…
– The contact alarm has been activated
Then…
– Turn on light
– Start Timer “Storeroom” with a duration of 7 min

Flow 2 (Close door)
When…
– The contact alarm has gone off
Then…
– Turn off light
– Stop Timer “Storeroom”

Flow 3 (Door stays open)
When…
– Timer “Storeroom” expired
Then…
– Turn off light

@jpcams, for this scenario you need a timer app. There are several apps in the app store, so it’s your choice. I use the Chronograph app, as Edwin already suggested.

4 Likes

And for the fun.

Flow 4 (Door closed after timer expired)

When…
– The contact alarm gone off

And…
– The light is off

Then…
– Speach (Let Homey say something) for example: You forgot to close the door again

That was it exactly! Thanks for helping me out. Now I will think about other things that I can connect with a timer.

Is there a topic already started where people talk about flows they use, especially flows more complex? I would be curious how I can strengthen my existing setup.

There is a thread category called Tutorials with some interesting flows. Also you can search for „DIY“, „Tutorial“ and „How to“, because not all tutorials are in this category.
But there are a lot of more interesting tutorials in the „Flows“ category, for example from @Justin.

I did it with two flows using the timer app.
First flow: Door open, start timer for xx seconds (timer will switch on the light and switch it off after xx seconds/minutes/hours)

Second flow: Door close, cancel timer and switch off light