Skip to content

Commit

Permalink
support Astral v2
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Apr 30, 2021
1 parent 30d85e3 commit b5eed58
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,17 @@ def __init__(
self._transition = min(
data[CONF_TRANSITION], self._interval.total_seconds() // 2
)
_loc = get_astral_location(self.hass)
if isinstance(_loc, tuple):
# Astral v2.2
location, _ = _loc
else:
# Astral v1
location = _loc

self._sun_light_settings = SunLightSettings(
name=self._name,
astral_location=get_astral_location(self.hass),
astral_location=location,
max_brightness=data[CONF_MAX_BRIGHTNESS],
max_color_temp=data[CONF_MAX_COLOR_TEMP],
min_brightness=data[CONF_MIN_BRIGHTNESS],
Expand Down

0 comments on commit b5eed58

Please sign in to comment.