mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
parent
a577a1953d
commit
40bc5dad17
1 changed files with 4 additions and 1 deletions
|
|
@ -1042,7 +1042,10 @@ class SunLightSettings:
|
|||
def _replace_time(date: datetime.datetime, key: str) -> datetime.datetime:
|
||||
time = getattr(self, f"{key}_time")
|
||||
date_time = datetime.datetime.combine(date, time)
|
||||
utc_time = self.time_zone.localize(date_time).astimezone(dt_util.UTC)
|
||||
try: # HA ≤2021.05, https://github.com/basnijholt/adaptive-lighting/issues/128
|
||||
utc_time = self.time_zone.localize(date_time).astimezone(dt_util.UTC)
|
||||
except AttributeError: # HA ≥2021.06
|
||||
utc_time = date_time.replace(tzinfo=dt_util.DEFAULT_TIME_ZONE).astimezone(dt_util.UTC)
|
||||
return utc_time
|
||||
|
||||
location = self.astral_location
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue