jay7210
(Jay Ingram)
October 27, 2019, 11:18pm
#1
Raspberry Pi 4, openHAB 2.4
Since the clocks went back last night in the UK my rules I have set using now.gethourofday are 60 minutes late. Is there anyway I can change this or is it a case of changing all my rules to be 60 out?
Also checked the pi current time and that is correct, even the times on the openHAB logs is correct. It’s only the rules that are out by 60 minutes.
Cheers
Have you verified the time zone settings?
1 Like
jay7210
(Jay Ingram)
October 27, 2019, 11:38pm
#3
Yes both in Pi Config and Paper UI. Both are correct
1 Like
In the OS too? Type date +%Z
to check.
rossko57
(Rossko57)
October 27, 2019, 11:48pm
#5
Much depends on what gethourofday is expected to return. The end of the second hour today was 0200, the end of the third hour was also 0200.
1 Like
jay7210
(Jay Ingram)
October 28, 2019, 11:14am
#6
So it will be anomaly just for the day the clocks change?
jay7210
(Jay Ingram)
October 28, 2019, 11:16am
#7
[11:12:54] openhabian@openhab : ~ $ date +%Z
GMT
[11:15:05] openhabian@openhab : ~ $ date
Mon 28 Oct 2019 11:15:24 AM GMT
[11:15:24] openhabian@openhab : ~ $
rossko57
(Rossko57)
October 28, 2019, 11:32am
#8
It’ll probably “come out in the wash” today, but we don’t really know what your ‘anomaly’ is or how you are using gethourofday. It might be improved with use of zonedDateTime.
jay7210:
GMT
GMT does not have daylight savings or “summer time” That could be your issue.
This is a list of time zones from release 2017c of the tz database.
UTC offsets (columns 6 and 7) are positive east of UTC and negative west of UTC. The UTC DST offset is different from the UTC offset for zones where daylight saving time is observed (see individual time zone pages for details). The UTC offsets are for the current or upcoming rules, and may have been different in the past.
The "Status" field means:
jay7210
(Jay Ingram)
October 28, 2019, 1:26pm
#10
The time at the command line is correct, where does the ‘Now.gethourofday’ get its time from?
Below is the example of the rule, so the issue is its only operating currentHour >16.
rule "Turn Sidelight On_LUX"
when
Item WeatherUV2 changed
then
var CurrentHour = now.getHourOfDay
if(CurrentHour <7 || CurrentHour >15){
if (GroundLights.state == OFF && WeatherUV2.state < 120){
GroundLights.sendCommand(ON)
sendBroadcastNotification("Side Lights ON")
}
}
end