Files
Domoticz/dzVents/examples/random night light.lua
2025-03-06 11:09:58 +01:00

25 lines
441 B
Lua

local RANDOM_DELAY_MINS = 30
return {
active = true,
on = {
['timer'] = {
'at sunset',
'at 01:00'
}
},
execute = function(domoticz)
if (domoticz.security ~= domoticz.SECURITY_DISARMED) then
local light = domoticz.devices('Window light')
if (not light.bState) then -- i.e. state == 'On'
light.switchOn().withinMin(RANDOM_DELAY_MINS)
else
light.switchOff().withinMin(RANDOM_DELAY_MINS)
end
end
end
}