emerald-hws 0.0.20__py3-none-any.whl → 0.0.22__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- emerald_hws/emeraldhws.py +22 -3
- {emerald_hws-0.0.20.dist-info → emerald_hws-0.0.22.dist-info}/METADATA +1 -1
- emerald_hws-0.0.22.dist-info/RECORD +7 -0
- emerald_hws-0.0.20.dist-info/RECORD +0 -7
- {emerald_hws-0.0.20.dist-info → emerald_hws-0.0.22.dist-info}/WHEEL +0 -0
- {emerald_hws-0.0.20.dist-info → emerald_hws-0.0.22.dist-info}/top_level.txt +0 -0
emerald_hws/emeraldhws.py
CHANGED
@@ -110,13 +110,14 @@ class EmeraldHWS():
|
|
110
110
|
if post_response_json.get("code") == 200:
|
111
111
|
self.logger.debug("emeraldhws: Successfully logged into Emerald API")
|
112
112
|
property_data = post_response_json.get("info", {}).get("property")
|
113
|
-
self.logger.debug(f"emeraldhws: API returned property data: {property_data}")
|
114
113
|
|
115
114
|
with self._state_lock:
|
116
115
|
self.properties = property_data
|
117
116
|
|
118
117
|
# Check if we got valid data
|
119
118
|
if not isinstance(property_data, list) or len(property_data) == 0:
|
119
|
+
# Log the full response when properties are invalid to help diagnose the issue
|
120
|
+
self.logger.debug(f"emeraldhws: Poperties empty/invalid, full response: {post_response_json}")
|
120
121
|
raise Exception("No heat pumps found on account - API returned empty or invalid property list")
|
121
122
|
else:
|
122
123
|
raise Exception("Unable to fetch properties from Emerald API")
|
@@ -156,8 +157,21 @@ class EmeraldHWS():
|
|
156
157
|
self.logger.info(f"emeraldhws: awsiot: Reconnecting MQTT connection (reason: {reason})")
|
157
158
|
|
158
159
|
if self.mqttClient is not None:
|
159
|
-
|
160
|
-
self.
|
160
|
+
# Clear connection event before stopping
|
161
|
+
self._connection_event.clear()
|
162
|
+
|
163
|
+
try:
|
164
|
+
# Stop the client and wait for it to fully stop
|
165
|
+
stop_future = self.mqttClient.stop()
|
166
|
+
if stop_future:
|
167
|
+
# Wait up to 10 seconds for clean shutdown
|
168
|
+
stop_future.result(timeout=10)
|
169
|
+
self.logger.debug("emeraldhws: awsiot: MQTT client stopped successfully")
|
170
|
+
except Exception as e:
|
171
|
+
self.logger.warning(f"emeraldhws: awsiot: Error stopping MQTT client: {e}")
|
172
|
+
finally:
|
173
|
+
# Always clear the client reference
|
174
|
+
self.mqttClient = None
|
161
175
|
|
162
176
|
self.connectMQTT()
|
163
177
|
self.subscribeAllHWS()
|
@@ -305,6 +319,8 @@ class EmeraldHWS():
|
|
305
319
|
""" Log message when stopped
|
306
320
|
"""
|
307
321
|
self.logger.debug("emeraldhws: awsiot: stopped")
|
322
|
+
# Clear connection event when stopped
|
323
|
+
self._connection_event.clear()
|
308
324
|
return
|
309
325
|
|
310
326
|
def on_lifecycle_disconnection(self, lifecycle_disconnect_data: mqtt5.LifecycleDisconnectData):
|
@@ -327,6 +343,9 @@ class EmeraldHWS():
|
|
327
343
|
self.logger.debug(f"emeraldhws: awsiot: disconnect data: {lifecycle_disconnect_data.__dict__}")
|
328
344
|
|
329
345
|
self.logger.info(f"emeraldhws: awsiot: disconnected - {reason}")
|
346
|
+
|
347
|
+
# Clear connection event when disconnected
|
348
|
+
self._connection_event.clear()
|
330
349
|
return
|
331
350
|
|
332
351
|
def on_lifecycle_attempting_connect(self, lifecycle_attempting_connect_data: mqtt5.LifecycleAttemptingConnectData):
|
@@ -0,0 +1,7 @@
|
|
1
|
+
emerald_hws/__init__.py,sha256=uukjQ-kiPYKWvGT3jLL6kJA1DCNAxtw4HlLKqPSypXs,61
|
2
|
+
emerald_hws/emeraldhws.py,sha256=DI3yaAoL_iNRqM480AuSKwVKa_nfbsvEVMdnrlW7OIA,28936
|
3
|
+
emerald_hws/__assets__/SFSRootCAG2.pem,sha256=hw9W0AnYrrlbcWsOewAgIl1ULEsoO57Ylu35dCjWcS4,1424
|
4
|
+
emerald_hws-0.0.22.dist-info/METADATA,sha256=aOWR41PKiop_mbtnkokueGiQuw46tFUB7nm84wnxvZk,2534
|
5
|
+
emerald_hws-0.0.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
+
emerald_hws-0.0.22.dist-info/top_level.txt,sha256=ZCiUmnBkDr2n4QVkTet1s_AKiGJjuz3heuCR5w5ZqLY,12
|
7
|
+
emerald_hws-0.0.22.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
emerald_hws/__init__.py,sha256=uukjQ-kiPYKWvGT3jLL6kJA1DCNAxtw4HlLKqPSypXs,61
|
2
|
-
emerald_hws/emeraldhws.py,sha256=fVyZ_9uQp9RfHTaAI0ZlHIj37hIn2lHDNeXO0vysV4I,28008
|
3
|
-
emerald_hws/__assets__/SFSRootCAG2.pem,sha256=hw9W0AnYrrlbcWsOewAgIl1ULEsoO57Ylu35dCjWcS4,1424
|
4
|
-
emerald_hws-0.0.20.dist-info/METADATA,sha256=UE32BxNZQMJmdZ62Q-CXOOr0u76QMVoMoUQfpDWtvOE,2534
|
5
|
-
emerald_hws-0.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
-
emerald_hws-0.0.20.dist-info/top_level.txt,sha256=ZCiUmnBkDr2n4QVkTet1s_AKiGJjuz3heuCR5w5ZqLY,12
|
7
|
-
emerald_hws-0.0.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|