Why are the sunrise and sunset times wrong?

Actually, it’s quite easy to determine your precise lat/longs and elevation above sea level. Just go to earth.google.com and find your location. These measurements are found in the lower right corner of the screen.

Seeing the comments about elevation, I decided to set that to zero in location settings. Sure enough, HA then agreed (within one minute) with my other sources. So I checked the HA documentaion, and it says to set that at your elevation above sea level. That would be correct only if you could see the sea; otherwise, it should be your elevation above the surrounding terrain.

Does HA use this elevation setting for any other purpose than adjusting sunrise and set times?

Probably also for home zone and distances from home.

If you rely upon Google yes, thou Ha uses OpenStreetMap , might differ a bit there ( well it Does differ ), using Google’s lat/long place me +100m off in OpenStreeMapp

PS: Does earth.gogle.com, gives you the same coordinate as google.com/map ( Same Spot ? )

Some Integrations might/do use the Elevation + Coordinates you’ve set in HA, such as in specific weather-integration

When I paste google earth coordinates into google maps it plots to within 25-30 meters, close enough. As far as weather integrations, I convert those with templates where needed, eg absolute pressure to sea level pressure. I haven’t used distance for anything, but I checked the device trackers on my mobile apps. My phone and tablet don’t appear on the map since they’re at home, but the coordinates in entity attributes show the correct lat/longs and the actual altitude from GPS. My chromebook does show on the map since it is in our second home. When I switch to that HA server I see my phone and tablet on that map. So, I’ll leave the site elevation set at zero for the correct sunrise/set times, unless I find something that breaks because of that. Thanks to all for the useful replies.

Ok, i don’t have problems with that, my phone ( or my place actually ) seems to always be unavailable from GPS over mobile ( 25-50m from my House ), and i seldom get a 3G connection here , so i only turn on GPS if i need a Driver guide :slightly_smiling_face: , and always call over , connects to Wifi when home ( doo to the blind spot i live in ) … so when im home, my phone is mostly 200km south of here ( because it’s not available for the mobile network )

Home Assistant uses the Astral package (currently v2.2) to calculate sun-related data & events. Some of the data it requests from the package require an “observer elevation.” In these cases, HA provides its elevation config value.

As mentioned previously, the value provided to the package should be the observer’s “elevation above ground level.” See Effect of Elevation from Astral’s documentation for more detail.

However, the HA documentation says the elevation configuration parameter is “Altitude above sea level in meters. Impacts sunrise data.” That seems like a documentation defect. I would think it should say “elevation above ground level.” (Honestly, I never noticed this before!)

But, having said that, there are at least five built-in integrations (medcom_ble, airthings_ble, met_eireann, openuv & met) that also use the elevation configuration parameter. I have no idea what they assume the value means.

I think the only thing that is agreed on is that the value is in meters!

1 Like

The altitude would have to be over sea level.
Ground level is impossible to put into a calculation unless you have the entire earths ground elevation for something like each meter in between.
The only case where a ground level would make sense would be if 3-axis GPS coordinates would be required to enter in the configuration, but that would mean only actually GPS readings could be used.
Google maps and I think all the other free map services only use 2-axis coordinates, because the 3. axis would require huge amount of data for ground levels with something like 1 meter in between each reading.

I think you misunderstood what I said and quoted.

The value you should enter into HA’s elevation option on the general system page is your elevation above the ground around you, not the elevation of that ground above sea level, or even your elevation above sea level. Unfortunately, this is not what the HA documentation says, because it’s wrong.

E.g., if you live in a regular house in a generally flat area, your elevation would be zero. If you live in a high-rise, your elevation would be the distance from ground level to your apartment/flat. If you live on a hill in an otherwise flat area, it would be the height of the hill as compared to the surrounding area.

You’re correct in that it would be impractical for a package like astral to accept altitude above sea level, because then, like you say, it would have to have access to a database containing worldwide elevations, which it does not.

2 Likes

There is no algorithm to calculate such a thing without the system knowing all the ground levels on the entire world.
The altitude has to be your altitude over sea level, which means your ground level over sea level + the level over that if you live in a high rise.
The sea level is set to the same around the world.

I’m sorry, but you are incorrect. Please follow the link I provided to the documentation of the astral package. Maybe I’m just explaining it poorly.

I was wrong. It seems to be somewhat more complicated.
It is not the height of the ground as such, because on a circle the formula will be the same for any size of the circle.
The problem comes when the circle is not really a circle, but more “bumpy”, which change the tangent line.
The post with pictures here explains it pretty well.

So it is a calculation you need to make over your own placement and the surroundings.
You can choose to do those calculations with measurements taken from the sea level or from the ground level (or from the center of earth if you so desire), as long as the measurement method is the same for all measurements.

That’s just the point. The calculations are done by the astral package, so it defines the inputs it needs. Again, you might want to browse its documentation.

The bottom line is, HA’s documentation misleads the users as to what value to enter for elevation so that the astral package can generate useful results.

1 Like

I found the page you might refer to: Setup basic information - Home Assistant
I agree that is wrong and should be reported as a bug!

Yep, I had a link to that above. :smile: I’ll probably just submit a PR at some point.

Ahh, I missed the link, because it had nothing with HA in the visible text. :smiley:

I would sometimes be nice, if you can just flag a post as a bug report.

I wouldn’t consider it as a bug, the description follows ( Common understandings ) , as mention , various Maps-provider etc , use varies measurement when they present their ( Facts ) , and the GAS whether you live in a sunken hole, on a slope or on top floor of empire state building.

People can use common sense, if they use Google as their source for gps, longitude/latitude, they can use their ( suggestion ) for altitude as well , and then add / subtract a few meter, if they need to (adapt) to either weather provider, or Sun integration ( From their specific “Point” of view )

That is exactly the point pnbruckner and I concluded. The altitude found on non-local sources have no meaning. Only the observation of the surroundings on the specific location makes sense.

The bug is that the description is plain and simple wrong.
You might call it common understanding, but then common understanding is wrong too.
Trying to argue for the common understanding here would be like arguing the earth is flat again. :slight_smile:

So your suggestion for the right description is ?

I mean , i took an average of what Google, and a “national” map-provider suggested, and came pretty close (only had to change few meters ( in height above sea-level ) :wink: , to match the Temperature of Met.no (weather-integration) , with my own local temp-Device
Even coordinates are slightly different for these 2 sources (so my house floating around a bit, depending upon which map-source i look at) :slightly_smiling_face:

Sorry i can’t see the forest because of all the trees :slightly_smiling_face: , so looking out the window i have no idea of how high up in the sky i am

Temperature?
We are talking about sunrise and sunset. Not temperature.

Trees are actually one of the things you could take into account and the lower your height because of that.

I don’t know what astral would do with a negative observer elevation.

Astral does have a second option for specifying observer elevation. Instead of a single number (i.e., height above ground level), it can also accept a tuple of two numbers, distance to, and height of, and obstruction, like mountains, or trees, etc. HA doesn’t support that (but I’m thinking about adding it to my custom Sun2 integration.)