python-hotspring 3.0.1__py3-none-any.whl → 3.1.0__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.
hotspring/hotspring.py CHANGED
@@ -224,7 +224,7 @@ class HotSpring: # pylint: disable=too-many-public-methods
224
224
  ):
225
225
  self.spa.connection_status.spa_connected = True
226
226
 
227
- if self.validate_device and self.spa.info.is_sna:
227
+ if self.validate_device and not self.spa.is_hna:
228
228
  msg = (
229
229
  f"Connected to Spa Network Adapter (SNA) with hostname "
230
230
  f"'{self.spa.info.hostname}'. The Home Network Adapter (HNA) "
@@ -303,7 +303,7 @@ class HotSpring: # pylint: disable=too-many-public-methods
303
303
  if identity_data:
304
304
  self.spa.update_info(identity_data)
305
305
 
306
- if self.validate_device and self.spa.info.is_sna:
306
+ if self.validate_device and not self.spa.is_hna:
307
307
  msg = (
308
308
  f"Connected to Spa Network Adapter (SNA) with hostname "
309
309
  f"'{self.spa.info.hostname}'. The Home Network Adapter (HNA) "
hotspring/models.py CHANGED
@@ -213,6 +213,18 @@ class Spa:
213
213
  """
214
214
  self.freshwater_iq = FreshWaterIQ.from_dict(data)
215
215
 
216
+ @property
217
+ def is_hna(self) -> bool:
218
+ """Return True if this device is the Home Network Adapter (HNA)."""
219
+ return self.info.sna_ready or bool(getattr(self.versions, "control_box", ""))
220
+
221
+ @property
222
+ def device_type(self) -> DeviceType:
223
+ """Determine whether the device is an HNA or SNA."""
224
+ if not self.info.hostname:
225
+ return DeviceType.UNKNOWN
226
+ return DeviceType.HNA if self.is_hna else DeviceType.SNA
227
+
216
228
 
217
229
  @dataclass
218
230
  class SpaInfo:
@@ -314,39 +326,24 @@ class SpaInfo:
314
326
  def device_type(self) -> DeviceType:
315
327
  """Determine whether the device is an HNA or SNA.
316
328
 
317
- The HNA (Home Network Adapter) is the intended API bridge.
318
- The SNA (Spa Network Adapter) is the tub-side module.
319
-
320
- On the HNA, the hostname suffix (last 6 characters, e.g. from
321
- 'ConnectedSpa_112233') matches the last 6 characters of the root_topic
322
- (e.g. 'mySpaAABBCC112233').
323
- On the SNA, root_topic still points to the paired HNA topic, but
324
- the hostname reflects the SNA's own MAC address.
329
+ Only the HNA can report 'SNAready' as 'Yes'; the SNA firmware always
330
+ reports 'No'. The hostname/rootTopic MAC suffixes cannot be used,
331
+ since rootTopic is built from the higher of the two adapter MACs.
325
332
 
326
333
  Returns
327
334
  -------
328
- DeviceType.HNA if hostname matches root_topic,
329
- DeviceType.SNA if hostname differs from root_topic,
330
- DeviceType.UNKNOWN if information is missing.
335
+ DeviceType.UNKNOWN if /startup data is missing,
336
+ DeviceType.HNA if sna_ready is True, otherwise DeviceType.SNA.
331
337
 
332
338
  """
333
- if not self.hostname or not self.root_topic:
339
+ if not self.hostname:
334
340
  return DeviceType.UNKNOWN
335
-
336
- mac_suffix = self.hostname.rsplit("_", 1)[-1]
337
- if self.root_topic.lower().endswith(mac_suffix.lower()):
338
- return DeviceType.HNA
339
- return DeviceType.SNA
341
+ return DeviceType.HNA if self.sna_ready else DeviceType.SNA
340
342
 
341
343
  @property
342
344
  def is_hna(self) -> bool:
343
345
  """Return True if this device is the Home Network Adapter (HNA)."""
344
- return self.device_type == DeviceType.HNA
345
-
346
- @property
347
- def is_sna(self) -> bool:
348
- """Return True if this device is the Spa Network Adapter (SNA)."""
349
- return self.device_type == DeviceType.SNA
346
+ return self.sna_ready
350
347
 
351
348
 
352
349
  @dataclass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-hotspring
3
- Version: 3.0.1
3
+ Version: 3.1.0
4
4
  Summary: Asynchronous Python client for Hot Spring Connected Spa Kit 2.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -0,0 +1,10 @@
1
+ hotspring/__init__.py,sha256=wV3giZmeCl0qdz6zStvbQAYOBc6d5qdAFzEaHViYKkA,1560
2
+ hotspring/const.py,sha256=ggMcA7ng0pdfquOAQdM7gUoF48J7ha5diya-YkYqFaA,14490
3
+ hotspring/exceptions.py,sha256=R8YwGfi6mXZ5DcHw4_fmtrRuvgkfOrLRCH-d3x6OUIw,1184
4
+ hotspring/hotspring.py,sha256=uQHNk5hTxHGRIxmiWzn-eGv7DVd0wiGrLouXahIIqaE,28896
5
+ hotspring/models.py,sha256=uiN7_VkHHLmKEagbRDBAa5xvYFLfZ98U_H93K-pkNd0,53465
6
+ hotspring/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ python_hotspring-3.1.0.dist-info/METADATA,sha256=lq6FH-ct7qVgisgJ24M0mLvVkI6GyyIaQwWKngNq5s8,8118
8
+ python_hotspring-3.1.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
9
+ python_hotspring-3.1.0.dist-info/licenses/LICENSE,sha256=4n3vNP1aJ5r8xLfzCCjo5l0EK5-k2-7w9rgucn7WVFM,1080
10
+ python_hotspring-3.1.0.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- hotspring/__init__.py,sha256=wV3giZmeCl0qdz6zStvbQAYOBc6d5qdAFzEaHViYKkA,1560
2
- hotspring/const.py,sha256=ggMcA7ng0pdfquOAQdM7gUoF48J7ha5diya-YkYqFaA,14490
3
- hotspring/exceptions.py,sha256=R8YwGfi6mXZ5DcHw4_fmtrRuvgkfOrLRCH-d3x6OUIw,1184
4
- hotspring/hotspring.py,sha256=sMuYgPZr_IOiF2K1oju6MkGDWiVSl-hsuaFBV_uqBIg,28898
5
- hotspring/models.py,sha256=S45nzQ37k8CTNEvJ5IZXylezbhmRBiLpRg9SVHltvFE,53598
6
- hotspring/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- python_hotspring-3.0.1.dist-info/METADATA,sha256=lNpZ6C2qjIRhnGxikU_tnivC7JdqmCHc0NIjP3B_m_I,8118
8
- python_hotspring-3.0.1.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
9
- python_hotspring-3.0.1.dist-info/licenses/LICENSE,sha256=4n3vNP1aJ5r8xLfzCCjo5l0EK5-k2-7w9rgucn7WVFM,1080
10
- python_hotspring-3.0.1.dist-info/RECORD,,