Why are the sunrise and sunset times wrong?

But more importantly, can anyone explain a use case wherein a 8 minute difference would make a significant impact on reaching the goal of the automation? Because I imagine a house across the street or clouds in the sky might have a more severe impact on sunlight hitting your home than the 8 minutes worth of sun movement mentioned. If you want true accuracy, buy a lux sensor.

1 Like

The problem is people put in feet instead of meters. And if you’re in e.g. Colorado and you put in 6800 as the value, your automatons are off by 13 minutes.

The field in the UI is misleading and does not specify units.

1 Like

But is it stating that it should be elevation above sea level, which is correct for other places, like temperature and weather.
It is just misleading for sun elevation.

HA is wrong here and so are smallfreak.

There is a long thread somewhere on the forum about it and we had to dive into the actual library for the sun calculation and the outcome was that the elevation is the one over the actually ground and not the one over the sea level.
I had the same idea as smallfreak back then, but I was convinced after a rather long decision about it and the diving into the calculations.

The UI is not correct, it should list ā€œobserver elevationā€ instead of ā€œabove sea levelā€. Someone just needs to step up and fix the translation key and phrase in English. All I have been describing in my comments on here and discord, is how the equation in the astral library works. Smallfreak is on some tirade here and github trying to say the calc is wrong and HA is at fault.

Please calm down, take a breath! Nobody wants to attack you or the project.

I’m in no way accusing anybody of anything. Especially not ā€œHA is wrongā€. What made you think I was postulating that?

If the library that is used does not get me good enough results for the supplied value, then it might be because the two parties don’t agree about the used parameters or that (untold) assumptions have been made that do not fit the expectations. Everything may be fine within it’s own domain, but when it does not match reality in the end, the domains may not overlap enough.

And I already DID say that I will look at the code to find out where the observed discrepancy about ā€œentering elevation does make a big difference in sunrise calculationā€ and ā€œastral does not even use elevation for calculating Sun positionā€ (as stated in the Astral docs) comes from. Maybe a misunderstanding in the Astral Doc. I didn’t make that one up, I just cited from their documentation.

If I enter a set of requested values and get a result that does not fit with real observation by a noticeable amount, than there somewhere is something that should be adjusted. This may be anything between ā€œget the values with more precisionā€ (the entered position might have been wrong, the local horizon is not taken into account, …), ā€œask for other valuesā€ (clarify their meaning) up to ā€œadjust the calculationā€ (or use a different library).

ā€œJust ignore the asked value, start with zero and enter arbitrary values until it fitsā€ is however not the most user friendly solution. Especially if this advice is given in a discussion, far off the application, where most users never will arrive. At least the users should get referred to a ā€œhow do I get the correct entry-values in the correct dimension that will result in a good fit between calculation and realityā€ right where you would expect it.

The fact that there obviously IS a confusion about the meaning of words and values is enough to see the need to enhance this. It’s nothing personal and does neither discredit you not the wonderful HA that I really love…

It’s good and it might become even better and easier to use, if expectations match the results more closely. Isn’t that the goal we are aiming at?

It’s the iteration ā€œTheory - Experiment - Observation - Verification - start overā€ that makes Science successful. No pun intended.

1 Like

Lets see, you initial post to me on github was:

That measure would make no sense if you don’t know the elevation above sea level too. Sunrise makes a big difference whether you are at the shore or atop of a mountain in a solar-panel equipped hut. A few meters ā€œabove groundā€ will not.

And you ignored my response:

But it does, try it yourself and watch it change by minutes.

To me this tells me that you disagree. Compound that with the fact that you ignored my comments here and attempted to use the documentation as proof in your following post.

I’m trying to make it clear that I’m talking in relation to the code with facts, not assumptions. I’ve read and contributed to the code base, I knew exactly where to look for the sun code. I investigated that sun issue a number of years ago, which lead to my comments here and on github.

I am not defending the code, I’m explaining where the issue lies. So my final and parting words are:

If you have issues with the algorithm, take it up with astral. The only change that would occur in HA is a rename of the field in general settings.

This is incorrect. Please see Effect of Elevation from the Astral documentation. Specifically,

If what obscures you at ground level is the horizon and you are at a [sic] elevation above ground level then the times of the sun depends on how far further round the earth you can see due to your elevation (the sun rises earlier and sets later).

As noted, this does not affect calculations for ā€œsolar elevationā€. However, it is used for all methods that calculate when a ā€œsolar eventā€ occurs. Ultimately, sunrise, dawn, etc. call time_of_transit, and shown below is where it uses the ā€œobserver elevationā€, which is either a distance above ground level, or a distance to an obstruction paired with the relative height of the obstruction to the observer.

I’m not an astronomer. I’m just the author of the ā€œSun2ā€ Home Assistant custom integration. My integration, as well as HA’s built-in Sun integration, rely on this astral package. I have no idea how it works, just how to use it.