mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-13 12:26:29 +00:00
Add astral 2.2 upgrade blog (#875)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
9078f380c9
commit
6e16c45514
34
blog/2021-04-09-astral-2.2.md
Normal file
34
blog/2021-04-09-astral-2.2.md
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
author: Martin Hjelmare
|
||||
authorURL: https://github.com/MartinHjelmare
|
||||
authorTwitter: MartinHjelmare
|
||||
title: Astral upgraded to version 2.2
|
||||
---
|
||||
|
||||
We recently merged a [pull request](https://github.com/home-assistant/core/pull/48573) to upgrade the astral library version used in Home Assistant Core to version 2.2. This will be released with Home Assistant 2021.5. This is a major version bump of Astral which includes some breaking changes, this caused us to update our built-in helpers and integrations that depend on astral. This has resulted in a couple of breaking changes to our sun helpers.
|
||||
|
||||
Custom integration authors that are maintaining integrations that use the sun helpers or the astral library directly, should review the breaking changes and update their custom integrations if needed.
|
||||
|
||||
The sun helper has changed its signature for `get_astral_location` and `get_location_astral_event_next` to include an `elevation` parameter. Also the return value of `get_astral_location` has changed to a tuple including elevation.
|
||||
|
||||
```py
|
||||
@callback
|
||||
@bind_hass
|
||||
def get_astral_location(
|
||||
hass: HomeAssistant,
|
||||
) -> tuple[astral.location.Location, astral.Elevation]:
|
||||
"""Get an astral location for the current Home Assistant configuration."""
|
||||
|
||||
@callback
|
||||
def get_location_astral_event_next(
|
||||
location: astral.Location,
|
||||
location: astral.location.Location,
|
||||
elevation: astral.Elevation,
|
||||
event: str,
|
||||
utc_point_in_time: datetime.datetime | None = None,
|
||||
offset: datetime.timedelta | None = None,
|
||||
) -> datetime.datetime:
|
||||
"""Calculate the next specified solar event."""
|
||||
```
|
||||
|
||||
Please see the [changelog of `astral`](https://github.com/sffjunkie/astral/blob/master/ChangeLog.md#22---2020-05-20) for further details.
|
Loading…
x
Reference in New Issue
Block a user