mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
open_meteo: correct UTC timezone handling in hourly forecast
The `datetime` variable is timezone-naive. Using `dt_util.as_utc(datetime)` incorrectly assigns the local timezone instead of UTC, leading to incorrect conversions. To fix this, directly assign the UTC timezone to the `datetime` variable before conversion, ensuring `dt_util.as_utc()` does not overwrite it with the local timezone.
This commit is contained in:
parent
409dc4ad48
commit
b3bdf80eb2
@ -156,6 +156,8 @@ class OpenMeteoWeatherEntity(
|
||||
|
||||
hourly = self.coordinator.data.hourly
|
||||
for index, datetime in enumerate(self.coordinator.data.hourly.time):
|
||||
if datetime.tzinfo is None:
|
||||
datetime = datetime.replace(tzinfo=dt_util.UTC)
|
||||
if dt_util.as_utc(datetime) < today:
|
||||
continue
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user