- Platform information:
- OS: ubuntu server 22.04 vs ubuntu server 24.04
- openhab 4.2.1 (Build)
- openjdk version “17.0.12” 2024-07-16 LTS
- OpenJDK Runtime Environment Zulu17.52+17-CA (build 17.0.12+7-LTS)
- OpenJDK 64-Bit Server VM Zulu17.52+17-CA (build 17.0.12+7-LTS, mixed mode, sharing)
Hi
I have set up two openhab devices identically with an ansible script. One device is based on ubuntu server 22.04 and one on ubuntu server 24.04. The time zone is set correctly on both devices.
The problem is that one system includes the local time zone for the values middaySun and afternoonSun in the rule (ubuntu server 22.04), the other does not.
Rules file:
val logName = "solarTimeOfDay"
var ZonedDateTime sunRise = null
var ZonedDateTime daylight = null
var ZonedDateTime middaySun = null
var ZonedDateTime afternoonSun = null
var ZonedDateTime eveningSun = null
var ZonedDateTime sunSet = null
rule "timeOfDay Calculate the times of this day"
when
System started or // run at system start in case the time changed when OH was offline
Time cron "0 3 0 * * ? *" // three minutes after midnight, to give Astro time to calculate the new day's times
then
// Convert the Astro Items to ZonedDateTime
sunRise = (sunrise_Time.state as DateTimeType).getZonedDateTime()
daylight = sunRise.plusHours(1)
sunSet = (sunset_Time.state as DateTimeType).getZonedDateTime()
eveningSun = sunSet.minusHours(1)
// Jump to tomorrow and subtract to avoid problems (summer time / winter time)
middaySun = now.withHour(0).withMinute(0).withSecond(0).plusDays(1).minusHours(24).plusHours(11)
afternoonSun = now.withHour(0).withMinute(0).withSecond(0).plusDays(1).minusHours(24).plusHours(13)
// Publish the current state
logInfo(logName, "Calculated sun rise: " + sunRise)
logInfo(logName, "Calculated daylight: " + daylight)
logInfo(logName, "Calculated midday sun: " + middaySun)
logInfo(logName, "Calculated afternoon sun: " + afternoonSun)
logInfo(logName, "Calculated evening sun: " + eveningSun)
logInfo(logName, "Calculated sun set: " + sunSet)
end
output on ubuntu server 22.04:
penhab.log:2024-09-08 15:56:40.888 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated sun rise: 2024-09-08T06:56+02:00
openhab.log:2024-09-08 15:56:40.889 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated daylight: 2024-09-08T07:56+02:00
openhab.log:2024-09-08 15:56:40.890 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated midday sun: 2024-09-08T11:00:00.887324888+02:00[Europe/Zurich]
openhab.log:2024-09-08 15:56:40.890 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated afternoon sun: 2024-09-08T13:00:00.887697629+02:00[Europe/Zurich]
openhab.log:2024-09-08 15:56:40.891 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated evening sun: 2024-09-08T18:51+02:00
openhab.log:2024-09-08 15:56:40.891 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated sun set: 2024-09-08T19:51+02:00
output on ubuntu server 24.04:
openhab.log:2024-09-08 14:08:37.514 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated sun rise: 2024-09-08T06:56+02:00
openhab.log:2024-09-08 14:08:37.519 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated daylight: 2024-09-08T07:56+02:00
openhab.log:2024-09-08 14:08:37.522 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated midday sun: 2024-09-08T11:00:00.503058880Z[Etc/UTC]
openhab.log:2024-09-08 14:08:37.525 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated afternoon sun: 2024-09-08T13:00:00.506116451Z[Etc/UTC]
openhab.log:2024-09-08 14:08:37.528 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated evening sun: 2024-09-08T18:51+02:00
openhab.log:2024-09-08 14:08:37.531 [INFO ] [hab.core.model.script.solarTimeOfDay] - Calculated sun set: 2024-09-08T19:51+02:00
Does anyone have any idea what the problem could be?
Best regards
Michael