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

Allow more flexible configuration of what affects sunrise & sunset events #116

Merged
merged 18 commits into from
May 9, 2024

Conversation

pnbruckner
Copy link
Owner

@pnbruckner pnbruckner commented Mar 20, 2024

Tasks

  • Add elevation option for observer obstruction vs horizon
  • Show current latitude/longitude/time-zone values in options flow with the ability to skip changing them
  • Select whether to specify latitude & longitude via a map or manually
  • Allow specifying elevation (height above ground and/or obstruction) even when using HA’s Home location configuration
  • Add sun2.get_location & sun2.update_location services
  • Add sunrise_azimuth & sunset_azimuth sensors
  • Do not do a full config reload if only location and/or observer elevation changes
  • Update services.yaml & en.json
  • Update documentation

Closes #111

Overview

Allow more flexible configuration of what affects sunrise & sunset events. See details below.

Also, add services to dynamically change integration entries (i.e., "locations") that were created via UI config flow and include location parameters (i.e., which do not use HA's location configuration.)

Lastly, add sensors to indicate the sun's azimuth at sunrise & sunset.

Together, these allow more dynamic use of this integration. E.g., for vacation, one might want to know sunrise, etc. at the vacation destination, which might be one place, or might change during the vacation. Another use case is where a mountain affects sunrise, but where the sunrise occurs (distance & relative height to the top of the mountain) changes throughout the year (i.e., as the azimuth of the sun at sunrise changes.)

Observer Obstruction vs Horizon

The astral package can accept two different types of data for certain events like sunrise & sunset to describe where these events are seen relative to the observer.

The first, which has been the only supported option so far, is the horizon. In this case, the elevation of the observer relative to ground level defines how much to adjust the event by due to the curvature of the Earth.

The second is an obstruction, such as the top of a mountain. This is defined by the horizontal distance to the obstruction, and the relative height of the obstruction from the observer, which can be negative if the obstruction is lower than the observer (e.g., the observer is on an even higher mountain.)

This PR adds support for defining either type for easterly events (sunrise, dawn) and westerly events (sunset, dusk.)

@pnbruckner pnbruckner changed the title Add elevation option for observer obstruction vs horizon Allow more flexible configuration of what affects sunrise & sunset events Mar 22, 2024
@pnbruckner pnbruckner merged commit d6a8de6 into master May 9, 2024
6 checks passed
@pnbruckner pnbruckner deleted the elevation branch May 9, 2024 13:40
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

Successfully merging this pull request may close these issues.

Dynamically updated longitute/latitude
1 participant