Skip to content

Allow more flexible configuration of what affects sunrise & sunset events

Compare
Choose a tag to compare
@pnbruckner pnbruckner released this 09 May 13:52
· 12 commits to master since this release
3b75033

Add elevation option for observer obstruction vs horizon

The astral package this integration uses 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 height of the obstruction relative to the observer (both expressed in meters), which can be negative if the obstruction is lower than the observer (e.g., the observer is on an even higher mountain.)

It is now possible to define either type for easterly events (sunrise, dawn) and westerly events (sunset, dusk.) Note also that the old elevation config option has been deprecated by the new observer_elevation option, and both are no longer associated with the location options (latitude, etc.), and hence, can be specified independently.

Add services & sensors

Add sun2.get_location & sun2.update_location services. Also add sunrise_azimuth & sunset_azimuth sensor options.

Together these allow dynamically updating location parameters, such as latitude, longitude and time zone, and/or parameters that define what affects sunrise & sunset events.

One use case might be for vacation. Let's say you add a config entry to get sun related info for a vacation location. You can use the services to update its location maybe once a day, or when you push a button in the UI, based on the current location indicated by a device tracker entity.

Another use case might be when, e.g., sunrise is based on a mountain, but the distance to, and the relative height of, the top of that mountain changes throughout the year as the sunrise azimuth changes.