Jump to content
  • 0

Basic question about events (light and movement)


Question

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

 

       

 

 

 

 

 

 

 

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I guess you have solved it by now, a couple of years later, but I fund while searching for answers on my own questions... Without doing the difficult coding you should have only one block scene which says that the light should turn on for x seconds when the sensor detects movement. Then you do not need a separate scene to turn the light off and you shouldn't have any problems with scenes running too many instances. 

//Hans

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...