emerald-hws 0.0.22__py3-none-any.whl → 0.0.24__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 +29 -6
- {emerald_hws-0.0.22.dist-info → emerald_hws-0.0.24.dist-info}/METADATA +2 -2
- emerald_hws-0.0.24.dist-info/RECORD +7 -0
- emerald_hws-0.0.22.dist-info/RECORD +0 -7
- {emerald_hws-0.0.22.dist-info → emerald_hws-0.0.24.dist-info}/WHEEL +0 -0
- {emerald_hws-0.0.22.dist-info → emerald_hws-0.0.24.dist-info}/top_level.txt +0 -0
emerald_hws/emeraldhws.py
CHANGED
@@ -109,13 +109,24 @@ class EmeraldHWS():
|
|
109
109
|
|
110
110
|
if post_response_json.get("code") == 200:
|
111
111
|
self.logger.debug("emeraldhws: Successfully logged into Emerald API")
|
112
|
-
|
112
|
+
info = post_response_json.get("info", {})
|
113
|
+
|
114
|
+
# Retrieve both property and shared_property arrays
|
115
|
+
property_data = info.get("property", [])
|
116
|
+
shared_property_data = info.get("shared_property", [])
|
117
|
+
|
118
|
+
# Combine both arrays into a single list
|
119
|
+
combined_properties = []
|
120
|
+
if isinstance(property_data, list):
|
121
|
+
combined_properties.extend(property_data)
|
122
|
+
if isinstance(shared_property_data, list):
|
123
|
+
combined_properties.extend(shared_property_data)
|
113
124
|
|
114
125
|
with self._state_lock:
|
115
|
-
self.properties =
|
126
|
+
self.properties = combined_properties
|
116
127
|
|
117
128
|
# Check if we got valid data
|
118
|
-
if
|
129
|
+
if len(combined_properties) == 0:
|
119
130
|
# Log the full response when properties are invalid to help diagnose the issue
|
120
131
|
self.logger.debug(f"emeraldhws: Poperties empty/invalid, full response: {post_response_json}")
|
121
132
|
raise Exception("No heat pumps found on account - API returned empty or invalid property list")
|
@@ -217,7 +228,9 @@ class EmeraldHWS():
|
|
217
228
|
on_lifecycle_attempting_connect = self.on_lifecycle_attempting_connect,
|
218
229
|
on_lifecycle_disconnection = self.on_lifecycle_disconnection,
|
219
230
|
on_lifecycle_connection_failure = self.on_lifecycle_connection_failure,
|
220
|
-
on_publish_received = self.mqttCallback
|
231
|
+
on_publish_received = self.mqttCallback,
|
232
|
+
# The default keep-alive is 20 minutes, which we might want to reduce
|
233
|
+
# keep_alive_interval_sec = 60,
|
221
234
|
)
|
222
235
|
|
223
236
|
client.start()
|
@@ -277,7 +290,7 @@ class EmeraldHWS():
|
|
277
290
|
def on_lifecycle_connection_failure(self, lifecycle_connection_failure: mqtt5.LifecycleConnectFailureData):
|
278
291
|
""" Log message when connection failed
|
279
292
|
"""
|
280
|
-
error = lifecycle_connection_failure.
|
293
|
+
error = lifecycle_connection_failure.exception
|
281
294
|
error_code = getattr(error, 'code', 'unknown')
|
282
295
|
error_name = getattr(error, 'name', 'unknown')
|
283
296
|
error_message = str(error)
|
@@ -306,6 +319,11 @@ class EmeraldHWS():
|
|
306
319
|
# Log all CONNACK properties if available
|
307
320
|
if hasattr(connack, '__dict__'):
|
308
321
|
self.logger.debug(f"emeraldhws: awsiot: CONNACK details: {connack.__dict__}")
|
322
|
+
|
323
|
+
if reason_code == mqtt5.ConnectReasonCode.CLIENT_IDENTIFIER_NOT_VALID:
|
324
|
+
self.logger.debug("emeraldhws: awsiot: The client identifier is not valid. Getting a new login token.")
|
325
|
+
self.getLoginToken()
|
326
|
+
self.reconnectMQTT(reason="invalid_client_id")
|
309
327
|
else:
|
310
328
|
self.logger.debug("emeraldhws: awsiot: no CONNACK packet available in failure data")
|
311
329
|
|
@@ -346,6 +364,7 @@ class EmeraldHWS():
|
|
346
364
|
|
347
365
|
# Clear connection event when disconnected
|
348
366
|
self._connection_event.clear()
|
367
|
+
self._is_connected = False
|
349
368
|
return
|
350
369
|
|
351
370
|
def on_lifecycle_attempting_connect(self, lifecycle_attempting_connect_data: mqtt5.LifecycleAttemptingConnectData):
|
@@ -422,8 +441,12 @@ class EmeraldHWS():
|
|
422
441
|
:param id: The UUID of the requested HWS
|
423
442
|
"""
|
424
443
|
with self._mqtt_lock:
|
425
|
-
|
444
|
+
retry = 0
|
445
|
+
while not self.mqttClient:
|
426
446
|
self.connectMQTT()
|
447
|
+
if retry >= 3:
|
448
|
+
raise Exception("MQTT client not connected after multiple attempts")
|
449
|
+
retry += 1
|
427
450
|
|
428
451
|
mqtt_topic = "ep/heat_pump/from_gw/{}".format(id)
|
429
452
|
subscribe_future = self.mqttClient.subscribe(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: emerald_hws
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.24
|
4
4
|
Summary: A package to manipulate and monitor Emerald Heat Pump Hot Water Systems
|
5
5
|
Author-email: Ross Williamson <ross@inertia.net.nz>
|
6
6
|
License-Expression: MIT
|
@@ -8,7 +8,7 @@ Project-URL: Homepage, https://github.com/ross-w/emerald_hws_py
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/ross-w/emerald_hws_py/issues
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
10
|
Classifier: Operating System :: OS Independent
|
11
|
-
Requires-Python: >=3.
|
11
|
+
Requires-Python: >=3.9
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
Requires-Dist: boto3<2.0.0,>=1.40.0
|
14
14
|
Requires-Dist: awsiotsdk<2.0.0,>=1.24.0
|
@@ -0,0 +1,7 @@
|
|
1
|
+
emerald_hws/__init__.py,sha256=uukjQ-kiPYKWvGT3jLL6kJA1DCNAxtw4HlLKqPSypXs,61
|
2
|
+
emerald_hws/emeraldhws.py,sha256=Cwk-4ixiJPATY9EuPOoWAdOu2o5v64BHIr610tfVeck,30048
|
3
|
+
emerald_hws/__assets__/SFSRootCAG2.pem,sha256=hw9W0AnYrrlbcWsOewAgIl1ULEsoO57Ylu35dCjWcS4,1424
|
4
|
+
emerald_hws-0.0.24.dist-info/METADATA,sha256=yUDQKxj5YRXw42KgqTkh2pDDXkOtzj0VtQ7txOf2-Y0,2534
|
5
|
+
emerald_hws-0.0.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
+
emerald_hws-0.0.24.dist-info/top_level.txt,sha256=ZCiUmnBkDr2n4QVkTet1s_AKiGJjuz3heuCR5w5ZqLY,12
|
7
|
+
emerald_hws-0.0.24.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
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,,
|
File without changes
|
File without changes
|