sunset in daylight savings time  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
gerben
Posts: 6
Joined: Thursday 25 August 2016 13:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Netherlands
Contact:

sunset in daylight savings time

Post 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
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: sunset in daylight savings time

Post 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 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
gerben
Posts: 6
Joined: Thursday 25 August 2016 13:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Netherlands
Contact:

Re: sunset in daylight savings time

Post 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.
gerben
Posts: 6
Joined: Thursday 25 August 2016 13:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Netherlands
Contact:

Re: sunset in daylight savings time  [Solved]

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest