Code: Select all
return {
on = {
devices = {
'Bevegelse_trapp2etasje', 'Bevegelse_Fibaro'}
},
execute = function(dz, item)
local LuxDevice = dz.devices(695)
local Lux = LuxDevice.lux
local Lights = dz.devices(710)
if Lux < 12 and item.state == "On" then
Lights.cancelQueuedCommands()
if dz.time.matchesRule("at 23:01-06:00") then
Lights.dimTo(10)
else
Lights.dimTo(50)
end
elseif item.state == "Off" and Lights.state == "On" then
Lights.switchOff().afterSec(90)
end
end
}
Code: Select all
return {
on = {
devices = {
'Bevegelse_trapp2etasje', 'Bevegelse_Fibaro'}
},
execute = function(dz, item)
local LuxDevice = dz.devices(695)
local Lux = LuxDevice.lux
local Lights = dz.groups("Lys2etasje")
if Lux < 12 and item.state == "On" then
Lights.cancelQueuedCommands()
if dz.time.matchesRule("at 23:01-06:00") then
Lights.dimTo(10)
else
Lights.dimTo(50)
end
elseif item.state == "Off" and Lights.state == "On" then
Lights.switchOff().afterSec(90)
end
end
}
Edit: no errors in logs (Have enabled Debug (Everything))
I'm using Conbee II and two Ikea Tradfri bulbs, a motion sensor from Fibaro and one from Xiaomi and deCONZ plugin