Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions framework/core/powerModules/kasaControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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):
Expand Down