I want to chase the lights before cutting power off.
There are four Lights, which should be switched (dimmed) off before switching of the power
Both attempts seem to ignore the Commands, and directly cut-off power / ZWSwi36.sendCommand(OFF)
My attempt using Thread::sleep
if (ZWSwi36.state == ON)
{
Tradfri_Dimm_1.sendCommand(0)
Thread::sleep(1000)
Tradfri_Dimm_2.sendCommand(0)
Thread::sleep(1000)
Tradfri_Dimm_3.sendCommand(0)
Thread::sleep(1000)
Tradfri_Dimm_4.sendCommand(0)
Thread::sleep(1000)
ZWSwi36.sendCommand(OFF)
}
And a Timer / without chasing
if (ZWSwi36.state == ON)
{
Tradfri_Dimm_All.sendCommand(0)
if(Tradfri_off == null)
{
Tradfri_off = createTimer(now.plusSeconds(4)) [|
ZWSwi36.sendCommand(OFF)
]
}
else
{
Tradfri_off.cancel
Tradfri_off = createTimer(now.plusSeconds(4)) [|
ZWSwi36.sendCommand(OFF)
]
}
}