Hi
I’m attempting to create a scene that is not triggered but can only be run when the user clicks ‘run’.
I want to turn a dimmable light on and off 3 times, something that should be very easy with code, but here is what happens…
When I run it with the light starting in an ‘off’ or ‘0%’ state, nothing happens.
When I run it with the light starting in an ‘on’ or ‘100%’ state, the light turns off once.
Here is my code. For now I’m staying away from loops as I troubleshoot.
I return ‘false’ because the code did all the work and nothing more needs to be done.
local livingRoomLight = 5
local SP_SID = "urn:upnp-org:serviceId:Dimming1"
local delay = 7
function cycleLightOn()
luup.call_action (SP_SID, "SetLoadLevelTarget", {newLoadlevelTarget = "100"}, livingRoomLight)
end
function cycleLightOff()
luup.call_action (SP_SID, "SetLoadLevelTarget", {newLoadlevelTarget = "0"}, livingRoomLight)
end
luup.call_delay("cycleLightOn", delay)
luup.call_delay("cycleLightOff", delay)
luup.call_delay("cycleLightOn", delay)
luup.call_delay("cycleLightOff", delay)
luup.call_delay("cycleLightOn", delay)
luup.call_delay("cycleLightOff", delay)
return false