I have some occasional hiccups with my PLEG conditions. Occasionally some things will not fire, sometimes they’re just a little slow. It’s not any specific device so I think I may just have too much on one PLEG instance, or maybe my logic simply isn’t efficient. Does anyone mind taking a look and offering any advice?
For me, removing “NOWs” that of course implies rethink your logic, worked very well. No more startups… sometimes some delays. I replaced the NOWs with timers.
I was going to go that route, and started, but couldn’t get it to work properly. This is what I came up with, does it look right?
Schedules
sPendantTimer Self ReTrigger None Interval 00:04:00 None false 0 0
Conditions
pendantLightsOn No (isNight AND kitchenMotion) OR (isDark AND kitchenMotion) false
pendantLightsOff No !mornLightSched AND !kitchenMotion AND !sPendantTimer true
Actions for Condition: pendantLightsOn
Device Actions:
Immediate
Device Action Arguments
Pendant Lights SetTarget newTargetValue=1
Stove Lights SetTarget newTargetValue=1
Utility Lights SetTarget newTargetValue=1
Program Logic Core StartTimer timerName=sPendantTimer intervalTime=
Actions for Condition: pendantLightsOff
Device Actions:
Immediate
Device Action Arguments
Pendant Lights SetTarget newTargetValue=0
Stove Lights SetTarget newTargetValue=0
Utility Lights SetTarget newTargetValue=0
I don’t know what exactly is that you want to achieve, could you post the corresponding “now” condition? To ‘translate’ it.
Maybe to the pendantLightsOff you should add a sequence for the timer:
[b]pendantLightsOff[/b] No !mornLightSched AND !kitchenMotion AND (pendantLightsOn; !sPendantTimer) AND !sPendantTimer true
[quote=“Vreo, post:4, topic:182708”]I don’t know what exactly is that you want to achieve, could you post the corresponding “now” condition? To ‘translate’ it.
Maybe to the pendantLightsOff you should add a sequence for the timer:
[b]pendantLightsOff[/b] No !mornLightSched AND !kitchenMotion AND (pendantLightsOn; !sPendantTimer) AND !sPendantTimer true
Original - pendantLightsOff !mornLightSched AND !kitchenMotion AND (!kitchenMotion;!kitchenMotion > 4:00)
The problem with the sequence you suggested is that my pendantLightsOn condition becomes false after 30 seconds (the kitchenMotion input becomes false - I can’t change the timeout on the motion sensor itself).
You need to add a new (third) condition. the one that starts the timer.
Sorry, I don’t follow. I thought the timer was called in an action - at least that’s how I read others doing it.
Actions for Condition: pendantLightsOn
Device Actions:
Immediate
Device Action Arguments
Pendant Lights SetTarget newTargetValue=1
Stove Lights SetTarget newTargetValue=1
Utility Lights SetTarget newTargetValue=1
Program Logic Core StartTimer timerName=sPendantTimer intervalTime=
Okay, I think I’ve wrapped my head around what you are saying. I need the third condition to stay true while the timer is running. If I wanted the default time of the motion sensor, I would not need this. Here’s what I have:
Schedules
sPendantTimer Self ReTrigger None Interval 00:04:00 None false
Conditions
pendantLightsOn No (isNight AND kitchenMotion) OR (isDark AND kitchenMotion) false
pendantLightsOff No !mornLightSched AND !kitchenMotion AND (pendantLightsTimer; !sPendantTimer) AND !sPendantTimer true
pendantLightsTimer No pendantsOn false
Actions for Condition: pendantLightsOff
Pendant Lights SetTarget newTargetValue=0
Stove Lights SetTarget newTargetValue=0
Utility Lights SetTarget newTargetValue=0
Actions for Condition: pendantLightsOn
Pendant Lights SetTarget newTargetValue=1
Stove Lights SetTarget newTargetValue=1
Utility Lights SetTarget newTargetValue=1
Program Logic Core RunAction conditionName=pendantLightsTimer
Actions for Condition: pendantLightsTimer
Program Logic Core StartTimer timerName=sPendantTimer intervalTime
I was thinking more of something like this:
Schedules
sPendantTimer Self ReTrigger None Interval 00:04:00 None false 0 0
Conditions
pendantLightsOn No (isNight AND kitchenMotion) OR (isDark AND kitchenMotion) false
StartPendantTimer No !mornLightSched AND !kitchenMotion
pendantLightsOff No !pendantTimer AND !sPendantTimer AND (!StartPendantTimer; !sPendantTimer) true
Actions for Condition: pendantLightsOn
Device Actions:
Immediate
Device Action Arguments
Pendant Lights SetTarget newTargetValue=1
Stove Lights SetTarget newTargetValue=1
Utility Lights SetTarget newTargetValue=1
Actions for Condition: StartPendantTimer
Device Actions:
Immediate
Device Action Arguments
Program Logic Core StartTimer timerName=sPendantTimer intervalTime=
Actions for Condition: pendantLightsOff
Device Actions:
Immediate
Device Action Arguments
Pendant Lights SetTarget newTargetValue=0
Stove Lights SetTarget newTargetValue=0
Utility Lights SetTarget newTargetValue=0
Thanks for the help Vreo, I appreciate it. I think I’m getting the hang of the timers now.
Quick question - is there any difference between this:
(isNight AND kitchenMotion) OR (isDark AND kitchenMotion)
and this?
(isNight OR isDark) AND kitchenMotion
No, it is exactly the same, but the second one is cleaner.