How to set Z-Wave Everspring Socket to turn off after a set time Period

Newbie question!!!
I am looking to get a Everspring socket to turn off after a set period of time, say 1 hour, from being activated. Can you point me in the right direction please?

a. You could add a delayed action to the scene that turns it on.

b. You could create a second scene that is triggered by the light being turned on, then a delayed action turns it off.

c. You could use the Program Logic Event Generator(PLEG) to replace this scene(s).

Option “c” is probably the best option. While both “a” and “b” will mostly/usually work, there is a potential issue if Vera reboots or reloads the LUUP engine during the count down time period. In that case the timer would be lost and the light would not turn off. It doesn’t happen often, but it can/does happen. It’s usually not a big deal if it is just a light that occasionally fails to turn off.

PLEG, on the other hand, would survive the reboot and still turn the light off after an hour. That’s why PLEG is a better choice than scenes if you’re looking at delayed actions of more than a few minutes.

I’m not familiar with the everspring outlet, but if it does power metering you could do something like this in the lua section, replace #76 with your device number. set it to trigger whenever the device goes above x watts.

--hair straightener left on
luup.call_delay( "turnOffSwitch", 1800)
-- Turn off the switch if power is being used after 30 mins.
function turnOffSwitch()
    local watts = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", 76) or "0"
    if (watts > "5") then
        luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" }, 76)

Thanks for the advice. Used Pleg this morning and had it set up and running in no time :slight_smile:
Thank again!!!