Hi guys,
I seem to be missing something very basic... And wonder if anybody could give me a pointer.
I want to do something as simple as this.
1) When movement is detected: Turn on the light
2) When there has been no movement for x seconds: Turn off the light (where x will be different for the different areas, e.g. from 15 seconds to 5 minutes)
So I create two scenes (using the graphic blocks)
1) Turn on lights, (IF motion == Breached 0s) THEN (Turn on Lights)
2) Turn off lights. (IF Motion == Safe 60s) THEN (Turn off lights)
But very frequently in my log, I see "Too many instances of the turn-off scenes". Which got me thinking. If I understand correctly, a new instance of 2) will be started every the sensor triggers that motion stops. So If I'm in the scene, and then move again within 60 seconds, scene 1) will be triggered again (but doing nothing, as the light is already on). When I stop moving again, yet another instance of 2) will be started. And then eventually, the max number of triggers are reached, which causes the error. The longer the timeout is, the more possible instances of 2) may be running.
So I guess I could increase the number of instances, but is this really a good idea?
Or am I going about this the wrong way? Should I instead create a LUA (which I haven't tried yet, but have a lot of programming experience), with the following two scenes:
1) Scene motion (motion == breached)
Set global variable motion = yes
if (number of instances > 1) exit
Turn on lights
while (variable motion == yes)
wait 10 seconds
while end
turn off lights
2) No-motion (motion == safe 60s)
set global variable motion = no
Thanks for any advice on this.
John Erik