pleg logic questions

I searched the forum and found some relevant info, but it was older. so i’m not sure what still applies with the newer version of pleg.

I have 2 questions

lights off = (NOT tKitchenMotion) AND (cKitchen_LightsON ; NOW > 15:00)

this is the condition statement i have for turning my kitchen lights off after they have been turned on by motion
the way i read that as written is it becomes true if there is no motion AND it’s been 15 minutes since the kitchen lights have been turned on.
do i need a self-re-triggering timer for this situation? my assumption is that when motion is detected subsequently the first part of this becomes false (i.e. there is motion) and it starts over with the 15 minutes because for the entire statement to be true both have to be true. is that correct? or does the 2nd part become true after 15 minutes regardless of the motion part of the condition?

if that is not correct and i need to include a 15 minute schedule timer in this situation, is 1 timer sufficient for all rooms or do i need multiple timers?
if i have timer1 for 15 minutes
can i reference that same timer in the kitchen and living room (and other rooms).
does one init of the timer affect another iteration?
basically do i need livingroomtimer and kitchen timer, etc?

Thanks!

I would have written this as:

llghtsoff = cKitchen_LightsOn AND (cKitchen_LightsMotion; NOW > 15:00)

That way the NOW timer is based on the LAST motion … not the first motion (i.e. when the light was turned on)
You can use a Retriggerable timer (On SelfRetrigger, Off Interval of 15:00) instead of NOW:

Then you would have
lightsoff = cKitchen_LightsOn AND (cKitchen_LightsMotion; !NameOfYourTimer)

Actions:
CKitchen_LightsMotion - Turn On Light, and Select the PLEG Device, Select the Start Timer Action, select the name of your Timer

thank you for the info. very helpful.

just for my continued understanding.
if i were to use timers. could i use 1 timer for all rooms. or do i need a specific timer for each room?

Thanks!

If the timer can be triggered by multiple devices at the same time, you should have different timers unless you do not mind the potential conflict.

Thanks for the reply… i ask because I’ve seen several pleg status reports and people seemed to have only 1 timer. since NOW can be used by multiple conditions, i didn’t know if they were all that way or not.

I’m trying to get my kitchen light to;

  1. turn on when its night and there is motion detected
  2. Continue to stay on when additional motion is detected, note the motion sensor seems to remain on when additional motion is detected after the initial incident. (I use red light on the sensor to indicate motion and green to indicate no motion detect… quick idiot indicator)
  3. Turn light off after 15 minutes without additional motion detected.

I seem to be able to turn on the light when its night and motion is detected. the problem is that the light turns off after 15 minutes due to the timer. What am I missing? I’ve attached my PLEG example (PDF) for what I’ve done to date. thanxs in advance.

Can you post a status? What you posted might be a “report”, but it doesn’t even show all the triggers, so something is wrong with the PDF…

I use the timer plug-in, and you can have it reset on motion so that the timer never counts down to 0. I have not used this feature in PLEG so I cannot help with that, but the timer creates a device that PLEG can control.

@wilme2, thanxs for responding, I’ve attached my associated status PDF. I’ve since modified my approach based on @bikesquid “daily lighting” example (another thread) which both simplified it and is working swimmingly as to what I was trying to do, I now turn off the light 2 minutes after no motion has been detected.

[quote=“MNB, post:6, topic:195711”]I’m trying to get my kitchen light to;

  1. turn on when its night and there is motion detected
  2. Continue to stay on when additional motion is detected, note the motion sensor seems to remain on when additional motion is detected after the initial incident. (I use red light on the sensor to indicate motion and green to indicate no motion detect… quick idiot indicator)
  3. Turn light off after 15 minutes without additional motion detected.

I seem to be able to turn on the light when its night and motion is detected. the problem is that the light turns off after 15 minutes due to the timer. What am I missing? I’ve attached my PLEG example (PDF) for what I’ve done to date. thanxs in advance.[/quote]

Question, I understand that once triggered the timer (below) runs for 15 minutes. What I’m not sure is within the Action setting what does the intervalTime do when set for example to 1:00, to the original timer 15 minutes?

Timer Name On Type On Time On Days Random On Delay Off After Type Off Time Off Days Random Off True s_BM_Timer15 Self Retrigger None Interval 00:15:00 None

Action
Device Action Arguments
Lighting PLEG[12] StartTimer [glow=yellow,2,300]timerName=s_UBR_Timer15 intervalTime=1:00[/glow]

Bump

[quote=“MNB, post:10, topic:195711”]Question, I understand that once triggered the timer (below) runs for 15 minutes. What I’m not sure is within the Action setting what does the interval Time do when set for example to 1:00, to the original timer 15 minutes?

Timer Name On Type On Time On Days Random On Delay Off After Type Off Time Off Days Random Off True s_BM_Timer15 Self Retrigger None Interval 00:15:00 None

Action
Device Action Arguments
Lighting PLEG[12] StartTimer [glow=yellow,2,300]timerName=s_UBR_Timer15 intervalTime=1:00[/glow]

[/quote]

I think in your case, Interval is actually when it ill stop, not the 15 mins from the Off Time… but I’m not sure, I like PLEG but the way some of the features are, and how they are named, is far from intuitive - even for someone who used to code a lot, like me :slight_smile:

from PLEG Basic PDF…
Interval - Repetitively becomes true every hh:mm:ss. Will be pinned to exact times so each hour will be on the hour, etc

The Start Timer action also allows the predefined Stop Type Interval to be optionally overridden by the time value entered in the action?s interval Time field.While a Self-Trigger timer is running, additional Start Timer actions for it will be ignored. In the case of a Self-ReTrigger timer, additional Start Time actions for it will restart the timer. This can be used to implement Watchdog functionality: If the timer is started by some periodic event, the absence of this event for the period set by the Stop Type Interval will allow the timer to complete and the Schedule to become false.

There is an advantage in setting a Schedule?s Stop Type to Interval rather than an absolute time. If PLEG happens to restart just before an absolute time, the stop event may not occur until the following day. With an Interval, PLEG is able to recover from the restart and set the state of the Schedule correctly.

The interval time in the action overrides the input schedule interval if provided.

Often the schedule is for a fixed interval time.
Occasionally you want to override this for a specific action (condition) … this allows you to do this.

Thanxs. your last sentence clarified it :slight_smile:

Currently working on a PLEG setup that will change my Fibaro RGBW colors depending on the temperature outside.

I’ve attached a PDF of my status report. I know that the issue has to be with my condition’s syntax, but I can’t seem to figure it out. Any help would be greatly appreciated!

Program Logic Event [165] Status Report.pdf (61.6 KB)