Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More realistic visualization and own source of Sun data #40

Closed
avataar opened this issue Mar 28, 2023 · 11 comments
Closed

More realistic visualization and own source of Sun data #40

avataar opened this issue Mar 28, 2023 · 11 comments
Assignees
Milestone

Comments

@avataar
Copy link
Collaborator

avataar commented Mar 28, 2023

The current version has two major drawbacks:

  • Use of Sun Integration for the event times: the reported times are always the next occurrence of the event and shift throughout the day, which complicates calculations and may show misleading times.
  • The graphics is fixed and too far from reality: the day part (upper part of the curve) is always bigger than the night (lower) part. In reality this varies by latitude and season. The further away from the equator and from the equinoxes you are, the larger the discrepancy. For example, in the winter in the northern parts of Scandinavia the Sun will crawl slowly through the night parts but pass quickly through the day part.

Proposed changes:

  • Use own source for the event times. Ideally, the same library should support Moon times too.
    • Sun Integration requirement no longer applies.
    • This may lead to slight discrepancies between times reported by the library and times reported by the Sun Integration because of different methods used to calculate things.
  • Adjust the Sun path curve/horizon line/travel to better reflect reality.
    • Constant speed of the Sun.
    • Size of day/night part corresponds to actual length.
    • Center the curve on solar noon and show 12 hours before and 12 hours after it.
      • This means the Sun will crawl to the right until it reaches solar midnight, which may be before or after midnight in the local time zone.
      • Shown event times always refer to the same -12/+12 hour around the current solar noon.
  • Always show the Sun, even when below the horizon.
    • Change Sun colour when close the horizon (more orange tint) and when below horizon (darker).

This is a major change compared to the original project.

I've already implemented this using https://www.npmjs.com/package/suncalc3 as the data source + basic Moon support #11. I still need to fine tune things and write some tests.

Here is a teaser showing different locations and different seasons (the title of each card shows the latitude, longitude and local time):
Screenshot 2023-03-28 at 14 00 48

@avataar avataar self-assigned this Mar 28, 2023
@ThomDietrich
Copy link

ThomDietrich commented Mar 28, 2023

This is amazing! You addressed multiple issues that make a lot of sense to me!

One thing you didn't even call out: Your moon already shows a shade according to it's phase. Incredible!

Question/thought on the side: Should we release a properly tested and cleaned up version 1.0.0 as a symbolic milestone before releasing these changes under a version 2.x? Cheers

@avataar
Copy link
Collaborator Author

avataar commented Mar 28, 2023

I had fun learning about SVG trickery with the moon :)

@ThomDietrich, I'm fine with your suggestion. For cleanup see also #41 - that would be lovely to see in 1.0.0 if someone does it but it's not a deal breaker.

@avataar
Copy link
Collaborator Author

avataar commented Apr 17, 2023

It's nearly complete, now with the ability to show moonrise, moonset, moon phase, and the azimuth/elevation of the Moon. Another major change is flipping the direction when South of the equator (see bottom two rows) as the Sun will point North at solar noon. The logic is that you are looking at the Sun as it moves across the horizon and it also makes things more consistent with the movement of the Moon. The flipping can be disabled via a config option. The font size is also slightly smaller. The shown moon phase (the symbolic one with the blue icon) is rotated to approximately match the latitude but this can be overridden via a config option.

screencapture-localhost-8123-new-horizon-default-view-2023-04-16-21_32_30

How it looks with different fields shown/hidden:

screencapture-localhost-8123-horizon-options-default-view-2023-04-16-21_44_19

@avataar avataar mentioned this issue Apr 17, 2023
@Tom-ahawk
Copy link

Tom-ahawk commented Apr 23, 2023

Excellent development progress : D

May I suggest a minor GUI option, - to use user selectable icon instead of text for sunrise and sunset etc. in front of the values. It might lower the height of the card a bit.

image

@wormuths
Copy link

This looks freaking beautiful...! Awesomeness...

@jefftherobot
Copy link

I love this update. Is there an ETA on release?

@wwwescape
Copy link

It's nearly complete, now with the ability to show moonrise, moonset, moon phase, and the azimuth/elevation of the Moon. Another major change is flipping the direction when South of the equator (see bottom two rows) as the Sun will point North at solar noon. The logic is that you are looking at the Sun as it moves across the horizon and it also makes things more consistent with the movement of the Moon. The flipping can be disabled via a config option. The font size is also slightly smaller. The shown moon phase (the symbolic one with the blue icon) is rotated to approximately match the latitude but this can be overridden via a config option.

screencapture-localhost-8123-new-horizon-default-view-2023-04-16-21_32_30

How it looks with different fields shown/hidden:

screencapture-localhost-8123-horizon-options-default-view-2023-04-16-21_44_19

Can't wait for this update. Any ETA?

@ThomDietrich
Copy link

I will give an answer, maybe @avataar wants to add a different though...

We are currently waiting for this project to be accepted as HACS default. After that merge users won't have to add the "custom repository" as a preliminary step. We were advised to wait with further codebase updates until the merge is over. @edwardtfn please correct me if I am wrong.

See #48 for more details.

@ThomDietrich
Copy link

ThomDietrich commented Jul 3, 2023

Hey @avataar,

Our addition to HACS default was declined and I have just created a new PR for it. See #1

This is overall not a pleasant development, however (!!) this opens the opportunity to continue with the development of your major changes these days - we can just as well release version 2 to HACS now. Wdyt?

@avataar
Copy link
Collaborator Author

avataar commented Jul 4, 2023

Honestly, I didn't expect the HACS thing would turn out like this, especially the long waiting period.

Since the current version is well below 1.0 (0.10.0) I see no point in releasing 1.0 just for the sake of having a 1.0 version with no major changes. I'll wrap up my changes described here + the moon support, open a PR and I believe that would be a good candidate for 1.0.

@ThomDietrich
Copy link

ThomDietrich commented Jul 4, 2023

@avataar looking forward to the PR!!

Regarding version 1.0: My suggestion was based on the idea that we have reached a rather stable and well tested version of the project. A "v1.0" is quite commonly used to advertise that step to a community.

Your PR will likely change a bigger part of the code base, unavoidably introduce new bugs, and start a chain of follow-up changes. I would see these changes as v1.1, v1.2, ..., eventually leading up to v2.0.

Anyhow, we don't have to over-complicate things. Let's see what others have to say

avataar added a commit that referenced this issue Jul 5, 2023
- Completely revamped calculations and Sun graph, now way more realistic
- Moon support: Moon on the graph, moonrise, moonset, Moon phase, Moon elevation and Moon azimuth
- Obeys Home Assistant's settings for time and number formatting
- Cleaned up config options
- Font size adjustments, including the smaller AM/PM text from the original card
- Lots of tests
- All lint warnings gone

Resolves the following issues:
- #11 - Moon support
- #30 - Horizon-card customize with card-mod
- #40 - More realistic visualization and own source of Sun data
- #54 - 24h format not working by default
avataar added a commit that referenced this issue Jul 13, 2023
- Completely revamped calculations and Sun graph, now way more realistic
- Moon support: Moon on the graph, moonrise, moonset, Moon phase, Moon elevation and Moon azimuth
- Obeys Home Assistant's settings for time and number formatting
- Cleaned up config options
- Font size adjustments, including the smaller AM/PM text from the original card
- Lots of tests
- All lint warnings gone

Resolves the following issues:
- #11 - Moon support
- #30 - Horizon-card customize with card-mod
- #40 - More realistic visualization and own source of Sun data
- #54 - 24h format not working by default
- #58 - Support HA 2023.7's local/server time zone setting
avataar added a commit that referenced this issue Jul 13, 2023
- Completely revamped calculations and Sun graph, now way more realistic
- Moon support: Moon on the graph, moonrise, moonset, Moon phase, Moon elevation and Moon azimuth
- Obeys Home Assistant's settings for time and number formatting
- Cleaned up config options
- Font size adjustments, including the smaller AM/PM text from the original card
- Lots of tests
- All lint warnings gone

Resolves the following issues:
- #11 - Moon support
- #30 - Horizon-card customize with card-mod
- #40 - More realistic visualization and own source of Sun data
- #54 - 24h format not working by default
- #58 - Support HA 2023.7's local/server time zone setting
@avataar avataar added this to the 1.0.0 milestone Jul 13, 2023
@avataar avataar closed this as completed Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants