Create Custom Schedule in LUUP or PLEG

Can anyone share code to create a schedule that will allow a scene only to be triggered between two particular times. An example is that I would want a light to turn on automatically every week day between 8:00 a.m. and 5:00 p.m. if the trigger in the scene is executed. Outside of those two times I do not want the trigger to run the scene.

one easy way…

create a virtual switch called something like “DaytimeSwitch”

Create a scene that turns it ON at 5:00

Create another that turns it OFF at 20:00

add Lua to the scene that you want to trigger that tests the switch:

local DaytimeStatus = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”, “Status”, 66)
if (DaytimeStatus == “1”) then
return true
else
return false
end

Replace 66 with your virtual switch device number

There is an example that does just this here.

Thank you all

There are other threads that have examples. I suggest you do a little searching.

  • Garrett