Ramping with PLEG

Hi Everyone
Here is an example created by Richard which i think a few people may benefit from so i will post it here.
I use this example for my kids bed time… When i toggle the bed time switch the lights are set to 25%. Then they slowly dim down to 5% (in my case over 10 mins) and then 30 minutes later they turn off.
Although this can be modified to how ever you like.
It could also be handy for roller shutters or blinds etc…

Input
LightLevel Current Light Level

Schedule
NextStepTimer On - Self Trigger, Off After 30 sec interval
OffTimer On - Self Trigger, Off after 30 minutes

Condition
Start What every you use to start this (i.e. some Multi-Switch turns on
KeepGoing (Start; !NextStepTimer) and !NextStepTimer and (LightLevel > 5) and (LightLevel <= 25)
AllOff (Start;OffTimer) and (LightLevel == 5)

Actions:
Start - Set light to 25 % and trigger NextStepTimer with an interval of 30 and trigger OffTimer with an interval of 30:00
KeepGoing Set Light to {(LightLevel - 1}} and trigger NextStepTimer with an interval of 30
AllOff Turn Off Light

Am I correct that the Start condition in this example must become false at some point during the first iteration of the conditions/actions or else the LightLevel will be continually reset to 25% each time the NextStepTimer is triggered? I.e., continuing the example of “some Multi-Switch turns on”, the Start Action would need to turn the Multi-Switch off?

I have enabled the pulse button feature on my muti switch button so it switchs off by itself pretty much instantly so it acks more as a scene controller instead of a switch…
although i dont think it would matter either way as the logic is not taking the current state of the switch into account
KeepGoing (Start; !NextStepTimer) and !NextStepTimer and (LightLevel > 5) and (LightLevel <= 25)

If Start does not go false, but you still want to trigger when it evaluates to true … you set the REPEATS flag on the condition.
That is a standard PLEG feature. You device if things happen when the go from false to true, or EVERY time they evaluate to true.

[quote=“RichardTSchaefer, post:4, topic:197593”]If Start does not go false, but you still want to trigger when it evaluates to true … you set the REPEATS flag on the condition.
That is a standard PLEG feature. You device if things happen when the go from false to true, or EVERY time they evaluate to true.[/quote]
Sitting here trying to rationalize the extra head-scratching and over-complication of several of my PLEG routines due to not utilizing this feature. Read about it several times but had forgotten. Thanks for the reminder. Off to clean up a few conditions and actions.

I was wondering is someone could share a status report of this in a working system? I’m struggling with the expression to set the new light level as well as re-trigger the timer.

Thank you!