sunset in daylight savings time
Posted: Tuesday 31 March 2020 11:46
I have some lights in my house connected to a "smart" power plug to have them automatically power on and off in the evening. Both 'on' and 'off' are defined via 'timer' button in the standard user interface. These lights turn on 10 minutes before sunset and this works ok.
One special light in my house is a 'zipato bulb 2+'. For this item I created a dzVents script to adjust white temperature and light intensity during the evening (see below). This script functioned good during winter time, but last sunday we changed into daylight savings time and now the light switches on 1 hour and 10 minutes before sunset instead of 10 minutes before sunset.
It seems as if sunset in dzVents is not corrected for daylight savings time, unlike sunset via the timer function of the standard user interface.
I could of course solve this by correcting for daylight savings time in the script, but in my opinion this should be corrected in dzVents
One special light in my house is a 'zipato bulb 2+'. For this item I created a dzVents script to adjust white temperature and light intensity during the evening (see below). This script functioned good during winter time, but last sunday we changed into daylight savings time and now the light switches on 1 hour and 10 minutes before sunset instead of 10 minutes before sunset.
It seems as if sunset in dzVents is not corrected for daylight savings time, unlike sunset via the timer function of the standard user interface.
I could of course solve this by correcting for daylight savings time in the script, but in my opinion this should be corrected in dzVents
Code: Select all
return {
on = {
timer = {'at 10 minutes before sunset','at sunset', 'every 5 minutes between 20:30 and 22:25', 'at 22:30', 'at 23:00', 'at 23:30'}
},
execute = function(domoticz, item)
local muranoLamp = domoticz.devices('RGBW murano lamp')
local lightTemp = 255
local lightBrightness = 80
local now = domoticz.time
if (now.matchesRule('at 20:30-22:28')) then
-- calculate minutes after 20:30
calcminutes = ((os.date("%H") - 20) * 60) + os.date("%M") - 30
lightTemp = 255 - domoticz.utils.round(254 * calcminutes/120)
lightBrightness = domoticz.utils.round(80 - (40 * calcminutes/120))
elseif (now.matchesRule('at 22:29-02:59')) then
lightTemp = 1
lightBrightness = 40
end
if (now.matchesRule('between 11 minutes before sunset and 23:29')) then
muranoLamp.setColor(0, 0, 0, lightBrightness, 0, 0, 2, lightTemp)
elseif (now.matchesRule('at 23:30')) then
muranoLamp.switchOff()
end
end
}