diff --git a/plugin.py b/plugin.py index 05e08fd..734933d 100644 --- a/plugin.py +++ b/plugin.py @@ -5,7 +5,7 @@ # Author: majki # """ - +

LG ThinQ domoticz plugin


Plugin uses LG API v2. All API interface (with some mods) comes from github.com/no2chem/wideq.

@@ -374,7 +374,6 @@ def onHeartbeat(self): except wideq.NotLoggedInError: # read AC parameters and Client state - Domoticz.Log("Session expired, refreshing...") self.lg_device = self.wideq_object.operate_device(device_id=self.DEVICE_ID) self.heartbeat_counter = self.heartbeat_counter + 1 @@ -731,8 +730,6 @@ def _force_device(self, client, device_id): return device def operate_device(self, device_id: str = ""): - lg_device = None - client = wideq.Client.load(self.state) client._country = self.country client._language = self.language @@ -744,15 +741,14 @@ def operate_device(self, device_id: str = ""): # Loop to retry if session has expired. while True: try: - if len(device_id) > 0: - lg_device = wideq.ACDevice(client, self._force_device(client, device_id)) + lg_device = wideq.ACDevice(client, self._force_device(client, device_id)) break except TypeError: Domoticz.Log("Could NOT log in. Probably you need to accept new agreement in the mobile app.") except wideq.NotLoggedInError or wideq.core.NotLoggedInError: - Domoticz.Log("Session expired.") + Domoticz.Log("Session expired, refreshing...") client.refresh() except UserError as exc: