home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.72k stars 28.88k forks source link

sun.sun time calculations are wrong due to elevation value #119795

Open EarlOfBurton opened 2 weeks ago

EarlOfBurton commented 2 weeks ago

The problem

sun.sun calculates wrong timestamps for next_sunrise and so on. It takes elevation of the home location into account that is set in Home Assistant (I mean the "home" elevation in meters above sea level (set in "Settings" -> "System" -> "General" -> "Elevation").

But this generates wrong values. For testing purposes I set the elevation to 0. If I set the elevation value to 0 (which is not correct for my place - correct would be 850 meters), the sun.sun timestamps are correct.

For the correct use of the astral python package it seems that the home assistant home zone elevation should not be taken into account?

But changing to a wrong elevation value (0) is not a workaround for me, because other addons/integrations use the elevation value for calculations.

Discussion with sun2-developer see under: https://community.home-assistant.io/t/next-rising-and-next-setting-still-shows-appr-2-minutes-too-late-gmt-1-central-europe-slovenia/566922

Kind regards

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

sun

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sun/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 2 weeks ago

Hey there @swamp-ig, mind taking a look at this issue as it has been labeled with an integration (sun) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `sun` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign sun` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


sun documentation sun source (message by IssueLinks)