Turn light off after x minutes

This has to be the simplest PLEG there is but being my first one I’m not sure how to go about setup. Just want one light to turn off after being on for 30 minutes. And that’s that.

It may seem the simplest ever but you also need to consider what happens if the light is turned off and then on again with the 30 mins. Does the timer restart or just continue from first trigger until it times out. There are always different situations to consider before you start to program.

I encourage you to look at @RexBeckett’s excellent PLEG Basics - An Introduction to the Program Logic Event Generator.

His first example is a Simple Motion-Triggered Light.

For your query:
Triggers:
LightOn Light is turned on

Conditions:
AutoOff !LightOn; LightOn > 30

Actions:
AutoOff Turn Light off

While I love PLEG, you don’t need it for this. Simply make a scene that has a trigger of “the light being turned on”, and have a 30 minute delayed action to turn it off. If you turned it off manually, then the scene won’t run which won’t matter anyway.

Looks like I already tried setting up a scene but didn’t finish it. I’ll see how it goes

Now that that’s covered, I also wanted another light to dim 10% every 30 minutes after being turned on until it’s completely off. Would PLEG be a better match for this? No idea where to start with the logic but I’ll look at the beginners guides mentioned previously.

In the action, set up immediate to 90%, delay 30 min to 80%, delay 60 min to 70%, ect until the light is 0%.

You might want something more appropriate that would handle manual override of switch.

Inputs:
Timer Scheduke - On - Self Retrigger, Off - 30 Minute interval Timer
SwitchOn Trigger Switch Turned On
SwitchLevel Device Variable - Switch Level

Conditions:
StartTimer SwitchOn
NewLevel (SwitchOn and !Timer and (SwitchLevel; !Timer)) ? (SwitchLevel > 10 ? SwitchLevel - 10 : 0): NewLevel

Actions:
StartTimer Start Timer (Advanced Tab for Action, PLEG Device, Action is StartTimer, Timer Name is Timer

NewLevel StartTimer (Same as Above]
Set Light Device Target Level to {(NewLevel)}
This is done in the advanced tab.

[quote=“Z-Waver, post:3, topic:188216”]I encourage you to look at @RexBeckett’s excellent PLEG Basics - An Introduction to the Program Logic Event Generator.

His first example is a Simple Motion-Triggered Light.

For your query:
Triggers:
LightOn Light is turned on

Conditions:
AutoOff !LightOn; LightOn > 30

Actions:
AutoOff Turn Light off[/quote]

This condition doesn’t seem to work for me.

Instead I used:

LightOn;NOW>1:00

After 1 minute of the light being turned on my action turns off the light.

Just setup my front door so when opened and if its night, it automatically turns on my internal porch entrance ceiling light and automatically turns it off.

Seems to be working OK.