python-hotspring 1.1.0__tar.gz → 1.2.0__tar.gz
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.
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/PKG-INFO +1 -1
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/pyproject.toml +1 -1
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/src/hotspring/models.py +26 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/LICENSE +0 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/README.md +0 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/src/hotspring/__init__.py +0 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/src/hotspring/const.py +0 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/src/hotspring/exceptions.py +0 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/src/hotspring/hotspring.py +0 -0
- {python_hotspring-1.1.0 → python_hotspring-1.2.0}/src/hotspring/py.typed +0 -0
|
@@ -202,6 +202,32 @@ class SpaInfo:
|
|
|
202
202
|
volume=int(model_status.get("volume") or 0),
|
|
203
203
|
)
|
|
204
204
|
|
|
205
|
+
@property
|
|
206
|
+
def mac_address(self) -> str:
|
|
207
|
+
"""Derive the MAC address from root_topic.
|
|
208
|
+
|
|
209
|
+
The HNA firmware builds root_topic as ``mySpa%02X%02X%02X%02X%02X%02X``
|
|
210
|
+
using the device's 6-byte WiFi MAC, so the 12 hex characters after the
|
|
211
|
+
``mySpa`` prefix are the full MAC address.
|
|
212
|
+
|
|
213
|
+
Returns
|
|
214
|
+
-------
|
|
215
|
+
Colon-separated uppercase MAC (e.g. ``"AA:BB:CC:11:22:33"``),
|
|
216
|
+
or ``""`` if root_topic does not match the expected format.
|
|
217
|
+
|
|
218
|
+
"""
|
|
219
|
+
prefix = "mySpa"
|
|
220
|
+
if not self.root_topic.startswith(prefix):
|
|
221
|
+
return ""
|
|
222
|
+
mac_hex = self.root_topic[len(prefix) :]
|
|
223
|
+
try:
|
|
224
|
+
mac_bytes = bytes.fromhex(mac_hex)
|
|
225
|
+
except ValueError:
|
|
226
|
+
return ""
|
|
227
|
+
if len(mac_bytes) != 6:
|
|
228
|
+
return ""
|
|
229
|
+
return ":".join(f"{b:02X}" for b in mac_bytes)
|
|
230
|
+
|
|
205
231
|
|
|
206
232
|
@dataclass
|
|
207
233
|
class Heater: # pylint: disable=too-many-instance-attributes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|