From c47ec58d1f448fa775c6d141b13d55f435f381bf Mon Sep 17 00:00:00 2001 From: TB-1993 <109213741+TB-1993@users.noreply.github.com> Date: Mon, 17 Feb 2025 13:01:40 +0000 Subject: [PATCH] Fix 149: Correct powerKasa to use is_on/is_off properties correctly --- framework/core/powerModules/kasaControl.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/framework/core/powerModules/kasaControl.py b/framework/core/powerModules/kasaControl.py index a1add16..3f474a7 100644 --- a/framework/core/powerModules/kasaControl.py +++ b/framework/core/powerModules/kasaControl.py @@ -83,8 +83,6 @@ def __init__( self, log:logModule, ip:str, args:str=None, options:str=None, **kw kwargs ([dict]): [any other args] """ super().__init__(log) - self.is_on = False - self.is_off = False self.slotIndex=0 self.ip = ip #config.get("ip") @@ -215,29 +213,24 @@ def __getstate__(self): self._log.debug(powerState) # Check if this strip is off if powerState[0] == "OFF": - self.is_on = False - self.is_off = True + self._is_on = False self._log.debug("Device state: OFF") return # Check if the this socket is off. if powerState[self.slotIndex+1] == "OFF": - self.is_on = False - self.is_off = True + self._is_on = False self._log.debug("Slot state: OFF") else: - self.is_on = True - self.is_off = False + self._is_on = True self._log.debug("Slot state: ON") else: result = self.performCommand("state") # | grep 'Device state' | cut -d ' ' -f 3 if "Device state: False" in result: - self.is_on = False - self.is_off = True + self._is_on = False self._log.debug("Device state: OFF") else: - self.is_on = True - self.is_off = False + self._is_on = True self._log.debug("Device state: ON") def reboot(self):