Page 1 of 1

sunset in daylight savings time

Posted: Tuesday 31 March 2020 11:46
by gerben
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

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
}

Re: sunset in daylight savings time

Posted: Tuesday 31 March 2020 22:50
by waaren
gerben wrote: Tuesday 31 March 2020 11:46 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.
Sorry but I cannot replicate this behavior in current stable nor in latest beta. dzVents receive sunset (in minutes after midnight) directly from main domoticz.
Your profile tells me you are on quite an old version is this stil true ?

Re: sunset in daylight savings time

Posted: Wednesday 01 April 2020 12:11
by gerben
1) Thank you for checking and responding.

2) Sorry, my profile data was quite outdated. Last weekend I updated to version 2020.1. So Actually I had two changes. An upgrade in Domoticz version and the change to daylight savings time.
For what it is worth, my domoticz still runs on the same hardware (a raspberry pi model 1B) and the software was always updated from the original installation in 2013 (yes it was updated to raspbian buster some domoticz versions ago).

3) I was not at home yesterday around sunset, so I could not observe and to prevent wear of my sdcard I had not enabled logging. I have just enabled logging so I can check the behaviour of the different lights in the logs.
I will post the relevant log data here after checking, probably tomorrow.

Re: sunset in daylight savings time  [Solved]

Posted: Wednesday 01 April 2020 21:16
by gerben
I checked again tonight and it behaves normal. Curious what I saw on sunday, but impossible to trace in absence of a log file.

@Waaren: again thanks for responding.