From bd5a24b0ed0dbfb45eb68d40504453bab927a01e Mon Sep 17 00:00:00 2001 From: "Steven B." <51370195+sdb9696@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:33:19 +0100 Subject: [PATCH] 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. --- kasa/iot/modules/time.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kasa/iot/modules/time.py b/kasa/iot/modules/time.py index 23cc5010..997a5b4d 100644 --- a/kasa/iot/modules/time.py +++ b/kasa/iot/modules/time.py @@ -37,8 +37,9 @@ class Time(IotModule): res["hour"], res["min"], res["sec"], + tzinfo=self.timezone, ) - return time.astimezone(self.timezone) + return time @property def timezone(self) -> tzinfo: