@XA44Owq26HxCq88;
That’s what I was thinking. I found this code for blinking the lights.
http://forum.micasaverde.com/index.php/topic,5127.msg272368.html#msg272368
This takes care of turning on and off. I’m waiting on the rest of my controllers to arrive to setup and test this.
Also, I haven’t added motion sensor or a new twist. I have a bi-level house so I have 5 steps up and 6 steps down. With this I want to turn all steps on in a up/down pattern when the door opens and when someone comes up or goes down the steps will illuminate one step at a time.
Two maybe three scenes all using similar code as below.
WITHOUT ORIGINAL STATUS
–Enter the device ID’s here in the array with your device id’s
– 133 - Stair lights 1
– 134 - Stair lights 2
local array_lights = {133,134}
local original_status={}
– loopspeed is the timeout between sending commands
local loopspeedms = 1000
– counter is the number of times to blink
local counter = 1
– delay is the number of seconds to wait between switching off-> on, and on->off
local delay = 8
– sleep() takes milliseconds not seconds - so we do the math here
local delayms = delay * 1000
function set_switch(device,value)
luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{ newLoadlevelTarget = 50 },device)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue=value },device)
end
– Turn all the switches in the array ON
function switch_on()
for i, device in ipairs(array_lights) do
set_switch(device,“1”)
luup.sleep(loopspeedms)
end
– Run a delay and then call switch_Off which turns them all back off.
– luup.call_delay( ‘switch_off’, delay )
end
– Turn off all the switches in the array
– This is only a stub - does not call switch_on
function switch_off()
for i, device in ipairs(array_lights) do
set_switch(device,“0”)
luup.sleep(loopspeedms)
end
end
– Main program
– Loop over the array “counter” times, with “delay” between loops.
function switch_run()
while counter > 0 do
counter = counter-1
switch_on()
luup.sleep(delayms)
switch_off()
luup.sleep(delayms)
end
end
switch_run()