Light blink when motion is detected and timer reset

Following the multiple examples on this forum i made a PLEG to automate some light in my home and keep them on as long as motion is detected. If motion has not been detected for more than 1 minute the light is turned of.

Turning on and turning off the lights based on motion or the lack of motion works just fine.
Keeping the lights on on the other hand creates some interesting behavior.

The light do stay on as long as motion has been detected within the timer limit of one minute, but the lights blink (quick on off) every minute (timer duration)

I must be doing something wrong but have not been able to find out what exactly.

Perhaps you can help me out?



tPantryLightsOn Pantry_Lights is turned on
tPantryMotion Pantry_Motion is tripped


sTimer_Pantry Self ReTrigger None Interval 00:01:00 None


cPantryLightsAutoOn No !tPantryLightsOn AND tNight AND tPantryMotion
cPantryLightsKeepOn No (tPantryLightsOn AND tPantryMotion AND (tPantryLightsOn; tPantryMotion)) OR cPantryLightsAutoOn
cPantryLightsAutoOff No tPantryLightsOn AND !sTimer_Pantry AND (tPantryLightsOn; !sTimer_Pantry)


Actions for Condition: cPantryLightsAutoOff

Device Actions:


Device Action Arguments
Pantry_Lights SetTarget newTargetValue=0
Actions for Condition: cPantryLightsAutoOn

Device Actions:


Device Action Arguments
Pantry_Lights SetTarget newTargetValue=1
Actions for Condition: cPantryLightsKeepOn

Device Actions:


Device Action Arguments
PLEG Occupancy StartTimer timerName=sTimer_Pantry intervalTime=

I think you need to set Repeat on for the Condition cPantryLightsKeepOn.

It makes it easier for us to help you if you post a PLEG Status report as a PDF.


Attached a PDF with my PLEG status report

I cannot see evidence of a problem in the Status report. tPantryMotion tripped at 21:05:49 and untripped 30 seconds later. The timer ended 1 minute after the trip at 21:06:50 and the light went off a few milliseconds later.

I know what he is talking about…

I have the exact same problem,

Condition becomes true and the light comes on… but when the timer condition becomes true, the light turns off and immediately back on. As if the conditions are are being satisfied in the wrong order or priority.

Alas, I dont have a fix for it… I just wanted to say I know what he is describing

As if the conditions are are being satisfied in the wrong order or priority.

Conditions don’t have a priority but the order is certainly important. They are evaluated from the top down. A change to a Condition will ripple-down to affect lower Conditions that refer to it but it does not cause re-evaluation of those above it.

The symptoms you describe can be caused by the Condition that should restart the timer failing to fire when the motion detector re-trips while the light is on. This may be because it is being held true by one of its terms. Setting Repeat on may solve this. It may also be because the expression can only be true if the light is off - the solution would be to remove that constraint.

I know what he is talking about..

I have the exact same problem,

Where is the status report that demonstrates your claims ?

My apologies Richard… I wasnt asking for help… I more saying, I know what he is trying to describe. Therefore I didnt include my status report as I wouldnt hijack his thread.

Attached a new status report showing the the following situation:

Pantry lights

  • Motion was detected
  • Pantry lights turned on just fine
  • i moved around in the pantry during the entire scenario
  • after 1 minute the pantry light turn off and do not turn on even when motion is detected
  • light turn on again if motion is detected after 1 minute of darkness…

Status report now shows

PantryLightAutoOn and PantryLightsKeepOn as True but the lights go out anyway.

Your pantry motion detector has remained in the tripped state for nearly four minutes. If it stays tripped as long as it detects motion then you cannot use it to restart the timer. As was suggested in another thread, you should change your logic so that is starts the timer when the motion detector turns off. Then, in the Condition that checks for the timer turning off, include the term and !motiondetectorname so that it will not turn off if new motion is detected.

Or you need to modify the device settings of your motion sensor (if it supports it) to reset to untripped after a few seconds of no motion.

Most POWERED motion sensors return an untripped condition within a second or two.

Most Battery powered motion sensors stay tripped for 4-5 minutes, which can be extended indefinitely as long as there is motion. In a busy area you might get a trip in the morning … and no other feedback until much later in the day when there is no activity.

How you use this in your logic depends on the behavior of your motion sensors. I do not use battery powered motion sensors … so they behave more like you expected.

My motion sensors, all fibaro, return to a non tripped after 30 seconds of no motion.(just checked it to be sure)
This is well within the timer limit of 1 minute so retripping the sensor after 30 seconds should prolong the time the light stay on.

If i understood you correctly my current logic should work just fine as long as my sensors return to a untripped state after a few seconds right?
Since thats the case please help me understand why my setup is not working correctly…

Thanks in advance

never mind… it works… :slight_smile:

I always tested this by creating motion within the time it took for the motion sensor to return to an untripped state.
That actually does not prolong the time the lights stay on as this is not seen a new event by PLEG/Vera.

When creating motion 31 seconds after the first motion was detected (sensors return to untripped state after 30s) the timer is reset and the light stay on.

Thank you for helping me understand what is going on.