Timer vs Device / Condition Last True

I’m still a bit confused when it is best to use which situation - and I have found no direct comparison info anywhere.

Setting a Timer is a bit more of a pain, and since it cannot be reset seem less flexible.
Also, is this accurate - this is how it works as part of a Condition?..
(Device < 30) : light/motion/etc device went true within the last 30 seconds
(Condition < 30) : condition went true within the last 30 seconds

thanks for your input!

Example of what I use frequently as part of other more complex logic:

Lights On/Off/Dim ONLY if something occurred within the last 30 seconds.
– Garage opened within the last 30 seconds = Lights on
– Kodi started playing video within the last 30 seconds = Lights dim

… this will ensure that if the lights were manually changed (wall switch or remotely via smartphone), they will stay as the manual setting and PLEG will not change them

I thought that was the point of a Self ReTriggering timer, is to restart the time back.

As a user you get to Specify the restart behavior. (SelfTrigger vs SelfReTrigger)

Your examples like the following are invalid syntax!

(Condition < 30)

A Sequence expression needs at least TWO things to compare … You are trying to use a Sequence Expression on only 1 input!
You separate the Inputs (Conditions or PLEG Inputs) with a sem-colon (The order is important) or comma (The order is not important).

You need to review the “Sequence Expression” information. This is more complex than the simple boolean logic … but it was makes PLEG very powerful.

[quote=“RichardTSchaefer, post:3, topic:189592”]As a user you get to Specify the restart behavior. (SelfTrigger vs SelfReTrigger)

Your examples like the following are invalid syntax!

(Condition < 30)

A Sequence expression needs at least TWO things to compare … You are trying to use a Sequence Expression on only 1 input!
You separate the Inputs (Conditions or PLEG Inputs) with a sem-colon (The order is important) or comma (The order is not important).

You need to review the “Sequence Expression” information. This is more complex than the simple boolean logic … but it was makes PLEG very powerful.[/quote]

I should have been more clear… a Timer cannot be Stopped.

Since Times require need for additional Inputs & Actions (StartTimer)… I’m hoping it is simple Condition statement to check when a Device/Condition was ‘last’ True - e.g. Was it True within the last # seconds, minutes, etc. It does not need to ‘still’ be True. I just care when it was last True.

I was using (Condition;NOW > 30), but the problem is it only checks it once every 1 minutes, correct?

If I use a compare such as… (!Kodi_VideoPlaying; Kodi_VideoPlaying < 30) … does this result True if the Video was not playing, then started playing within the last 30 seconds?

[quote=“Aaron, post:4, topic:189592”][quote=“RichardTSchaefer, post:3, topic:189592”]As a user you get to Specify the restart behavior. (SelfTrigger vs SelfReTrigger)

Your examples like the following are invalid syntax!

(Condition < 30)

A Sequence expression needs at least TWO things to compare … You are trying to use a Sequence Expression on only 1 input!
You separate the Inputs (Conditions or PLEG Inputs) with a sem-colon (The order is important) or comma (The order is not important).

You need to review the “Sequence Expression” information. This is more complex than the simple boolean logic … but it was makes PLEG very powerful.[/quote]

I should have been more clear… a Timer cannot be Stopped.

Since Times require need for additional Inputs & Actions (StartTimer)… I’m hoping it is simple Condition statement to check when a Device/Condition was ‘last’ True - e.g. Was it True within the last # seconds, minutes, etc. It does not need to ‘still’ be True. I just care when it was last True.

I was using (Condition;NOW > 30), but the problem is it only checks it once every 1 minutes, correct?

If I use a compare such as… (!Kodi_VideoPlaying; Kodi_VideoPlaying < 30) … does this result True if the Video was not playing, then started playing within the last 30 seconds?[/quote]

Yes a timer can’t be stopped only reset, but if you using something like above and <30 secs then that also can;t be stopped. That statement will be true after 30sec unless you have more logic in your condition which can also me used in your Timer statement too. So seems like a wash, except your right it does involve more work. I have swapped out all my “NOW” logic to a timer as a direct replacement to have actual times.

[quote=“integlikewhoa, post:5, topic:189592”][quote=“Aaron, post:4, topic:189592”][quote=“RichardTSchaefer, post:3, topic:189592”]As a user you get to Specify the restart behavior. (SelfTrigger vs SelfReTrigger)

Your examples like the following are invalid syntax!

(Condition < 30)

A Sequence expression needs at least TWO things to compare … You are trying to use a Sequence Expression on only 1 input!
You separate the Inputs (Conditions or PLEG Inputs) with a sem-colon (The order is important) or comma (The order is not important).

You need to review the “Sequence Expression” information. This is more complex than the simple boolean logic … but it was makes PLEG very powerful.[/quote]

I should have been more clear… a Timer cannot be Stopped.

Since Times require need for additional Inputs & Actions (StartTimer)… I’m hoping it is simple Condition statement to check when a Device/Condition was ‘last’ True - e.g. Was it True within the last # seconds, minutes, etc. It does not need to ‘still’ be True. I just care when it was last True.

I was using (Condition;NOW > 30), but the problem is it only checks it once every 1 minutes, correct?

If I use a compare such as… (!Kodi_VideoPlaying; Kodi_VideoPlaying < 30) … does this result True if the Video was not playing, then started playing within the last 30 seconds?[/quote]

Yes a timer can’t be stopped only reset, but if you using something like above and <30 secs then that also can;t be stopped. That statement will be true after 30sec unless you have more logic in your condition which can also me used in your Timer statement too. So seems like a wash, except your right it does involve more work. I have swapped out all my “NOW” logic to a timer as a direct replacement to have actual times.[/quote]

Would be nice to have a basic time compare. Maybe something like a special identifier for Last True & Last False time properties.
Example… Device:LT<30

integlikewhoa, when you converted to Timers, was there a performance improvement - wondering if the system uses less cycles than with NOW?

I use NOW a lot because most of my items dont need exact times. Closing my garage or turning off a light in 15min vs 16min does not make a difference. But things that are under 1 minute clearly that will not work.

ToggleTimer on a running timer will stop it.

My Condition with the times is not working as I expect it to.

The goal is that the Condition to fires when the Timer Is True (while it is running, not after it stops). I only want it to change the lights in the room right after I start a video… the problem I’m having is that without the timer, PLEG will change the light level immediately if I manually set the lighting - basically undoing my manual light setting.

I with there was an easy way to tell it “don’t change if I manually set the light” but I havent seen a way to do this so I figure the easiest would be a timer

I have tried two different statements…

!(MediaRoomLights_level < 50) AND (KODI_VideoStarting or KODI_VideoResumed) AND Timer_30s

and

!(MediaRoomLights_level < 50) AND (KODI_VideoStarting or KODI_VideoResumed) AND ((KODI_VideoStarting;Timer_30s) or (KODI_VideoResumed;Timer_30s))

… what am I doing wrong?

thx for the help

If you attach a PLEG Status report, we can take a look…

attached

Any help would be appreciated, I cannot get it working

Sent from my HTC6525LVW using Tapatalk

Status appears to be scan - OK but makes it a little harder to read and follow. I am having some trouble understanding your logic.

One thing occurs to me - it seems like Condition KodiTimer should be Repeats “Yes”. Otherwise there will be periods the condition stays true and does not restart the timer.

I’m trying to make a basic… ‘if the Timer is running’

Thus the condition is…

!(MediaRoomLights_level < 50) AND (KODI_VideoStarting or KODI_VideoResumed) <— this was what I had originally, and works fine

AND Timer_30s ← trying to add this so that it only runs when the Timer is True (still within 30 seconds of the event I’m tracking)

I don’t understand why the Repeats needs to be on? If the Timer is set for SelfRetrigger, should it not set itself back to False as soon as the 30 seconds expires? I need the Condition to mirror the True or False state of the Timer.

thx for the help

anyone?

The timer is TRUE when it’s running and FALSE otherwise … So I do not know what you are asking.
Have you checked the STATUS report and looked at the Last on and off times for your timer ?

[quote=“RichardTSchaefer, post:15, topic:189592”]The timer is TRUE when it’s running and FALSE otherwise … So I do not know what you are asking.
Have you checked the STATUS report and looked at the Last on and off times for your timer ?[/quote]

Yes, and the Last On time corresponds with the device(s) that make the Condition to start the timer True.

I have these condition to turn lights off (video started) and then back on (video paused or stopped)… but only within 30 seconds of the video event change… Without a Timer, PLEG would always turn lights when MediaRoom_VideoPause was true, even hours after it was first True… thus, retriggering when I tried to turn the lights off manually. This is another case where using the Last True time in a comparison would help, and eliminate the need for a Timer.

KodiTimer
KODI_VideoStarting or KODI_VideoResumed or KODI_VideoStopped or KODI_VideoEnded or KODI_VideoPaused

MediaRoom_VideoPlay
(MediaRoomLights_level < 30) AND (KODI_VideoStopped or KODI_VideoEnded or KODI_VideoPaused) AND Timer_30s

MediaRoom_VideoPause
(MediaRoomLights_level > 30) AND (KODI_VideoStarting or KODI_VideoResumed) AND Timer_30s

thx for the help

A sequence expression compares the time stamps of the arguments.

You might get better response if you put your problem stuff in a standalone PLEG and describe your problem with a FULL status report.

I often ignore status reports that have lots of unrelated lines because I do not want to spend the time sorting through what inputs, conditions, and actions are appropriate for the problem.

[quote=“RichardTSchaefer, post:17, topic:189592”]A sequence expression compares the time stamps of the arguments.

You might get better response if you put your problem stuff in a standalone PLEG and describe your problem with a FULL status report.

I often ignore status reports that have lots of unrelated lines because I do not want to spend the time sorting through what inputs, conditions, and actions are appropriate for the problem.[/quote]

I’m pretty sure we can nail this if I understand how the sequence expression should work.

How would I do a Seq for… video was playing stopped within the last 30 seconds?

Does this work…

KODI_VideoStopped and (KODI_VideoStarting; KODI_VideoStopped < 30)?

That would be true ONLY if you started and stopped within 30 seconds of starting.

(KODI_VideoStopped; KODI_VideoStopped < 30)

?