Use tzinfo in time constructor instead of astime for iot devices (#1158)

Fixes using `astime` on a non tzinfo aware object which causes issues with daylight saving.
This commit is contained in:
Steven B. 2024-10-08 12:33:19 +01:00 committed by GitHub
parent 7c1686d3ae
commit bd5a24b0ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,8 +37,9 @@ class Time(IotModule):
res["hour"], res["hour"],
res["min"], res["min"],
res["sec"], res["sec"],
tzinfo=self.timezone,
) )
return time.astimezone(self.timezone) return time
@property @property
def timezone(self) -> tzinfo: def timezone(self) -> tzinfo: