if device = on and between specified time interval
Posted: Friday 04 August 2017 23:55
Hello, i'm trying a very simple script but without success. I need to turn on a light "Bano Lampada" when the PIR is ON (Sensore Movimento) but only during the night, suppose an interval between 23:00 and 07:00.
That's what i do, but it doesn't works. If i remove the 'time' part works fine obviously... so i'm not using correctly the time function of dzvents.... any help is very appreciated, thanks in advance.
That's what i do, but it doesn't works. If i remove the 'time' part works fine obviously... so i'm not using correctly the time function of dzvents.... any help is very appreciated, thanks in advance.
Code: Select all
return {
active = true,
on = {
devices = {
'Sensore Movimento'
}
},
execute = function(domoticz, Bagno)
if domoticz.devices('Sensore Movimento').state == 'On' then
if (domoticz.time.hour > 23 and domoticz.time.hour < 7) then
domoticz.devices('Bagno Lampada').switchOn().forMin(2)
end
end
end
}