Help me understand the Sun device

I’m very confused about the Sun device. I have set my timezone to CET (GMT +2) and the location correctly using the map. A template with the code {{ now() }} displays the time correctly as my local time.

On the dashboard the Sun device visualization displays Midnight (Mitternacht) always at 1 AM. When checking at 0:59 AM today the next sunrise (Morgendämmerung) was displayed as in 6 Hours, so that would be 6:59 AM. The actual sunrise was at 7:48 AM (German weather service).

What is going on?

My troubles with TIME went away with add-on “chrony”.
Have a look at it…

Check that your server and end device times and dates are correct.

CET is not GMT+2.
CET is GMT+1.

Because of daylight saving time (DST) CET is now UTC+2 (and not UTC+1 like in the winter).

GMT is effected by DST while UTC does not.
Maybe that’s the cause of your confusion.

Home Assistant OS shell timezone (read only file system) is displayed as:
Mon Oct 21 22:52:06 UTC 2024

Time within the Home Assistant Dev-Tools is displayed as:
{{ now() }}
2024-10-22 00:52:06.207130+02:00

Time on Windows is 00:52:06 (set to CET).

Next Midnight in SUN device dashboard is displayed as in 8 Minutes (which is wrong apparently).

p.s.

Will try the chrony addon, as Sun seems useless. Thanks for the tip.

You got this with “date” over ssh right? I get Tue Oct 22 01:51:17 CEST 2024
So you probably got your location settings wrong which is also why the time is not off by exactly 1h.

{{now}} displays the end device time if I remember correctly.

Yes, date is over SSH. I don’t think {{now}} displays device time, as all my automations do work correctly. If I set an automation to 6 AM local time, it’s executed exactly at 6 AM.

The SUN time is off by 1 hour, but the SSH time is off by 2 hours to my local time.

Okay I thought that was the issue because you had another timezone from the shell.
Now I looked myself if it is correct and yes midnight is at 1:15 but as you are using the Dämmerung (dusk) sensor, I know your problem is that you need the sensor.sun_next_rising (I dont have the german translation). That one and the setting sensor do show the same for me as the website. So the definitions are not what we expected which leads me to think that midnight is not 0:00 but the middle between rise and setting. Sorry but I am also still learning.

The sun integration have issues with the observer elevation.
It takes the value from the system settings under the general tab, but that is elevation over the sea level and the sun integration needs elevation over the surface level, which is usually 0.

I suggest you use the Sun2 integration instead.

Installed Sun2 via Hacks. It shows the same data, but the labels are different. It’s not “midnight”, but “Solar midnight” instead. So it confuses less, as solar midnight is not the same as midnight.

The Sun2 parameter “Sun Rising” corresponds exactly to the sun rising of my weather app in my area.