Wrong sunrise and sunset time

Hi,

I have a problem with the sunrise and sunset times. I have set the timezone and coordinates correctly, but the times are exactly two hours behind the actual time for some reason. I tried messing around but just couldn’t solve it. Any thoughts?

homeassistant:
  latitude: -37.81498
  longitude: 114.9539
  elevation: 41
  unit_system: metric
  time_zone: Australia/Melbourne

I’m betting that your OS thinks it’s in the wrong timezone. So it’s not a Home Assistant issue, per se. Here’s some instructions for setting the timezone in Linux:

http://www.thegeekstuff.com/2010/09/change-timezone-in-linux/

Hi,

Although I suspected this, I did not really check. I checked after posting and it showed me a UTC time, and I reconfigured it just to be sure. I didn’t do a restart and the problem persisted (which is why I didn’t delete this post), however, after your suggestion I did a restart and things became normal.

Cheers.

Edit: turns out to be an error in the coordinates.

just checking on the map and the text pasted in for latitude and longitude could have a typo
if you go to those coordinates on a map you get a point somewhere in the sea below Perth, which is two hours behind Melbourne
if I change 114.9539 to 144.9539 then that goes to a coordinate in Melbourne…

Why didn’t I notice?

This is the coordinates my Smartthings hub gave me. Urgh.

Thanks for pointing it out.

Far easier changing coordinates in a configuration file than adjusting the Sun :wink:

Please correct that the sunset is displayed approx. 2 min than eg NodeRED or online sunset calc, including Google (sunset)

eg today is the sunset:

20:39

and hass shows 20:41

The location in hass is set correctly.

I can confirm there’s a 2-minute discrepancy between Home Assistant’s sunset time and Google.

Where I live, the sun has not set yet and Home Assistant indicates today’s sunset time is 20:28:25.

Google reports today’s sunset will be at 20:26.

Screenshot from 2021-05-22 11-21-22

The local weather service also reports 20:26.

Screenshot from 2021-05-22 11-24-23

I suggest you report this as an Issue in Home Assistant’s GitHub Core repository:

I had to do the following. I had my time correct, and time zone correct in HA and Linux.

Sun needs the actual location, because the sun doesn’t come up at the same time throughout a time zone. FYI, you can go to Settings → System → General → Edit location to get the map view of your location, then drag the Home icon to the correct location (as opposed to simply moving the map)