The whole purpose of the flow: when movement is detected, or someone opens the door, turn on the light. If I keep moving, keep the light on. If I stop moving, after some time, turn off the light.
With two relatively elegant flows and the Flow Event Bus and Timer apps, this should be possible.
I have various sensor devices in a zone. The Zone emits a ‘someone-is-there’ event on flow event bus. With the first flow.
There is a second flow which reads this event and turns on the lights via a Timer (480 seconds, start timer even when device is already on, use longest timeouts, after 1 second)
The sensor devices publish new status every 30 or 60 seconds, depending on config, so this should keep triggering zone activation, which should keep triggering the event.
Everything works and lights automatically switch on and off:
if, within the 480 seconds all events cease
However: if I keep moving in the area, and sensors keep publishing the ‘someone-is-there’ event, then at a certain point in time around the 480 seconds mark, all lights go off, and they do not turn on for some time, regardless whether or not ‘someone-is-there’ events are published.
I am suspecting an issue with the Timer app, or the Zone activation functionality but I cannot be sure. I suspect the latter, but again: not sure.
For people who prefer hands-on: these are my flows:
I’m not familiar with the timer app, I ucan se Chronograph, for several reasons. One is, that it provides great control over timers, such as:
Start or restart timer
Start or continue timer
Is timer running
Timers active are visible in app configuration, together with countdown time.
In your case, you’d want movement to start or restart time timer, so the full time is started with every movement, regardless if the timer was already running (and maybe almost done). I don’t know what the timer app does, but from wat you tell me the first movement determines when the lights go out, regardless what happens after.
On a second note, as some one pointed out to me earlier: if you are talking about movement sensors then you should start time timer when movement stops, not starts. Continued movement might not trigger new flows to reset the timer. This can be debugged by adding notifications.
I had the Chronograph first but I used it to trigger timers when movement starts. Your remark about triggering timers when movement stops makes sense.
A reason to switch from Chronograph is that it would create the need to have more than two flows. This is where Timer comes in: it can trigger both ON and OFF states of the timed devices.
I will first start by triggering on zone deactivation instead of activation and see how I fare from that point onwards.
I think that will solve it, but at the expense of another flow for zone inactivity. One a zone is active, it won’t keep sending zone active triggers, whatever activity keeps happening. It will stay active quietly until movement stops.
I’ve resigned to the fact that Homey will have flow spaghetti, and try to keep the spaghetti organised.
Indeed I made a mistake assuming that ZONE ACTIVE would continuously be triggered. But I can indeed see (now) that once a zone is active and I keep moving, it is not retriggered. This means that timers will run out and lights turn OFF.
That is precisely what seemed to be happening in my initial flows.
Now I have changed into flows that
trigger zone activated -> movement detected event
trigger zone inactive -> movement stopped event
and two reaction flows:
movement detected event: turn light on and turn off timer that turns off light
movement stopped event: start timer to turn light off
Just found out that I had 2 zones “Hallway” with the same name but these were two zones in different floors. Once I fixed this by selecting the appropriate zone, I got the flows to work properly.