edwardtfn / home-assistant-sun-card

Home Assistant Sun card based on Google Weather design
MIT License
49 stars 7 forks source link

[Bug] Fix the sun position calculations #6

Closed edwardtfn closed 1 year ago

edwardtfn commented 1 year ago

Copy the proposed fix from the original repository:

PR description:

Fix the sun position calculations:

  • Use now() as a basis for normalizing all next_xxx values from Home Assistant and locat date/time attributes insteod of UTC (since it should be from the viewpoint of the HA setup)
  • Use a single source for now() so it's consistent in all the calculations
  • Also fixed the readTime test as it was sensitive to the time zone of the test environment This works well for the entire 24h span - I checked by hacking the now value to loop the entire day and "tomorrow" (i.e. simulating today past midnight).
avataar commented 1 year ago

Hey @edwardtfn, we're reviving the project here: https://github.com/rejuvenate/lovelace-sun-card. You're welcome to join. I plan to rework this PR and do some more tests before I resubmit it there.

edwardtfn commented 1 year ago

That's awesome. I will cancel my PR on HACS default then and will work on this repo you are indicating.