Hoping that someone could help me out..
I have a script witch during night time and motion detect turns on the hallway light.
Right now it turns on at a preset level(25) when between sunset and midnight.
But i would like to remember at witch level the light was set manually lets see 37%
Is this possible?
Also the lights should go out after midnight when no motion detected.
But when they are one at 5% before midnight it doesnt automaticcly turns off at midnight or 5 min later.
Code: Select all
return {
active = true,
on = {
devices = {
['PIR Gang'] = { 'at nighttime' },
timer = {'every 5 minutes at nighttime'}
}
},
execute = function(domoticz, motion)
local light = domoticz.devices('Lamp Gang')
if domoticz.time.matchesRule("between sunset and 00:00") and (motion.state == 'On') then
light.dimTo(25)
elseif domoticz.time.matchesRule("between sunset and 00:00") and (motion.state == 'Off') then
light.dimTo(5)
elseif domoticz.time.matchesRule("between 00:00 and sunrise") and (motion.state == 'On') then
light.dimTo(15)
elseif domoticz.time.matchesRule("between 00:00 and sunrise") and (motion.state == 'Off') then
light.switchOff()
end
end
}