What's wrong this code ? Lights switch on but shut down too fast. Lasts only under minute and then switch off.
Code: Select all
return {
active = true,
on = {
devices = {
'Kuisti_liike'
},
},
execute = function(dz, item, valo, kytkin)
local valo = dz.devices('Kuisti')
local sensor = dz.devices('Kuisti_liike')
local Lux = dz.devices('Aqara Motion Sensor_lux')
local LUX = Lux.lux
if (sensor.state == 'On' and LUX <= 30 ) then
dz.devices('Kuisti').switchOn().forMin(2)
else
dz.devices('Kuisti').switchOff()
end
end
}