python-hotspring 4.0.1__tar.gz → 4.0.2__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-4.0.1 → python_hotspring-4.0.2}/PKG-INFO +1 -1
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/pyproject.toml +1 -1
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/src/hotspring/__init__.py +2 -0
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/src/hotspring/const.py +17 -1
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/src/hotspring/hotspring.py +219 -53
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/LICENSE +0 -0
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/README.md +0 -0
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/src/hotspring/exceptions.py +0 -0
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/src/hotspring/models.py +0 -0
- {python_hotspring-4.0.1 → python_hotspring-4.0.2}/src/hotspring/py.typed +0 -0
|
@@ -23,7 +23,7 @@ packages = [
|
|
|
23
23
|
readme = "README.md"
|
|
24
24
|
repository = "https://github.com/Moustachauve/python-hotspring"
|
|
25
25
|
# The CI/CD and GitHub Actions release workflows are responsible for setting the version tag
|
|
26
|
-
version = "4.0.
|
|
26
|
+
version = "4.0.2"
|
|
27
27
|
|
|
28
28
|
[tool.poetry.dependencies]
|
|
29
29
|
aiohttp = ">=3.0.0"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from .const import (
|
|
4
4
|
BrightnessLevel,
|
|
5
5
|
DeviceType,
|
|
6
|
+
Endpoint,
|
|
6
7
|
EnergySavingMode,
|
|
7
8
|
HeatingMode,
|
|
8
9
|
JetSpeed,
|
|
@@ -49,6 +50,7 @@ __all__ = [
|
|
|
49
50
|
"ConnectionStatus",
|
|
50
51
|
"DeviceType",
|
|
51
52
|
"Diagnostics",
|
|
53
|
+
"Endpoint",
|
|
52
54
|
"EnergySaving",
|
|
53
55
|
"EnergySavingMode",
|
|
54
56
|
"FreshWaterIQ",
|
|
@@ -2,7 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from enum import Enum
|
|
5
|
+
from enum import Enum, StrEnum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Endpoint(StrEnum):
|
|
9
|
+
"""HTTP path served by the Home Network Adapter (HNA).
|
|
10
|
+
|
|
11
|
+
Each member's value is the request path, so members can be passed anywhere
|
|
12
|
+
a plain ``str`` URI is accepted.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
STATUS = "/status"
|
|
16
|
+
STARTUP = "/startup"
|
|
17
|
+
SPA_MODEL = "/spamodel"
|
|
18
|
+
SPA_CONNECT_STATUS = "/spaConnectStatus"
|
|
19
|
+
FRESHWATER_IQ = "/getFWIQData"
|
|
20
|
+
DEBUG_DATA = "/addDebugData"
|
|
21
|
+
SPA_MANAGER = "/spaManager"
|
|
6
22
|
|
|
7
23
|
|
|
8
24
|
class HeatingMode(Enum):
|
|
@@ -8,7 +8,8 @@ import json
|
|
|
8
8
|
import logging
|
|
9
9
|
import time
|
|
10
10
|
from dataclasses import dataclass
|
|
11
|
-
from
|
|
11
|
+
from http import HTTPMethod
|
|
12
|
+
from typing import TYPE_CHECKING, Self
|
|
12
13
|
|
|
13
14
|
import aiohttp
|
|
14
15
|
from yarl import URL
|
|
@@ -17,6 +18,7 @@ from .const import (
|
|
|
17
18
|
_BRIGHTNESS_TO_WIRE,
|
|
18
19
|
VALID_ENERGY_SAVING_SCHEDULE_IDS,
|
|
19
20
|
BrightnessLevel,
|
|
21
|
+
Endpoint,
|
|
20
22
|
HeatingMode,
|
|
21
23
|
JetSpeed,
|
|
22
24
|
LightColor,
|
|
@@ -38,6 +40,9 @@ from .models import (
|
|
|
38
40
|
SpaInfo,
|
|
39
41
|
)
|
|
40
42
|
|
|
43
|
+
if TYPE_CHECKING:
|
|
44
|
+
from collections.abc import Callable, Iterator
|
|
45
|
+
|
|
41
46
|
_LOGGER = logging.getLogger(__name__)
|
|
42
47
|
|
|
43
48
|
|
|
@@ -48,6 +53,16 @@ def _describe_exception(exception: BaseException) -> str:
|
|
|
48
53
|
return type(exception).__name__
|
|
49
54
|
|
|
50
55
|
|
|
56
|
+
@contextlib.contextmanager
|
|
57
|
+
def _parsing(uri: str) -> Iterator[None]:
|
|
58
|
+
"""Raise a model parser's failure on a malformed payload as HotSpringError."""
|
|
59
|
+
try:
|
|
60
|
+
yield
|
|
61
|
+
except (AttributeError, KeyError, TypeError, ValueError) as exception:
|
|
62
|
+
msg = f"Unexpected data from {uri}: {exception!r}"
|
|
63
|
+
raise HotSpringError(msg) from exception
|
|
64
|
+
|
|
65
|
+
|
|
51
66
|
@dataclass
|
|
52
67
|
class HotSpring: # pylint: disable=too-many-public-methods
|
|
53
68
|
"""Main class for handling connections with a Hot Spring Spa.
|
|
@@ -77,7 +92,7 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
77
92
|
async def request(
|
|
78
93
|
self,
|
|
79
94
|
uri: str = "",
|
|
80
|
-
method: str =
|
|
95
|
+
method: HTTPMethod | str = HTTPMethod.GET,
|
|
81
96
|
data: dict[str, object] | None = None,
|
|
82
97
|
) -> dict[str, object]:
|
|
83
98
|
"""Handle a request to the Hot Spring HNA.
|
|
@@ -89,7 +104,7 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
89
104
|
Args:
|
|
90
105
|
----
|
|
91
106
|
uri: Request URI, for example ``/status``.
|
|
92
|
-
method: HTTP method
|
|
107
|
+
method: HTTP method (``HTTPMethod`` or its string value).
|
|
93
108
|
data: Dictionary of data to send to the HNA.
|
|
94
109
|
|
|
95
110
|
Returns:
|
|
@@ -207,12 +222,32 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
207
222
|
)
|
|
208
223
|
return response_data
|
|
209
224
|
|
|
210
|
-
async def _safe_request(self,
|
|
225
|
+
async def _safe_request(self, endpoint: Endpoint) -> dict[str, object] | None:
|
|
211
226
|
"""Fetch an endpoint, returning None on error."""
|
|
212
227
|
with contextlib.suppress(HotSpringError):
|
|
213
|
-
return await self.request(
|
|
228
|
+
return await self.request(endpoint)
|
|
214
229
|
return None
|
|
215
230
|
|
|
231
|
+
async def _fetch[T](
|
|
232
|
+
self,
|
|
233
|
+
endpoint: Endpoint,
|
|
234
|
+
parse: Callable[[dict[str, object]], T],
|
|
235
|
+
*,
|
|
236
|
+
method: HTTPMethod | str = HTTPMethod.GET,
|
|
237
|
+
data: dict[str, object] | None = None,
|
|
238
|
+
) -> T:
|
|
239
|
+
"""Request an endpoint and parse its response, naming it on bad data.
|
|
240
|
+
|
|
241
|
+
Raises
|
|
242
|
+
------
|
|
243
|
+
HotSpringError: If the request fails or ``parse`` rejects the
|
|
244
|
+
payload as malformed (attributed to ``endpoint``).
|
|
245
|
+
|
|
246
|
+
"""
|
|
247
|
+
response = await self.request(endpoint, method=method, data=data)
|
|
248
|
+
with _parsing(endpoint):
|
|
249
|
+
return parse(response)
|
|
250
|
+
|
|
216
251
|
async def update(self, *, refresh_identity: bool = False) -> Spa:
|
|
217
252
|
"""Get all spa information.
|
|
218
253
|
|
|
@@ -238,28 +273,32 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
238
273
|
------
|
|
239
274
|
HotSpringSNADetectedError: If connected to a Spa Network Adapter (SNA)
|
|
240
275
|
and ``validate_device`` is True.
|
|
241
|
-
HotSpringError: If no data is returned from the spa.
|
|
276
|
+
HotSpringError: If no data, or malformed data, is returned from the spa.
|
|
242
277
|
|
|
243
278
|
"""
|
|
244
279
|
if not self._identity_loaded or refresh_identity:
|
|
245
|
-
status_res = await self.request(
|
|
246
|
-
startup_res = await self._safe_request(
|
|
247
|
-
connect_res = await self._safe_request(
|
|
248
|
-
model_res = await self._safe_request(
|
|
280
|
+
status_res = await self.request(Endpoint.STATUS)
|
|
281
|
+
startup_res = await self._safe_request(Endpoint.STARTUP)
|
|
282
|
+
connect_res = await self._safe_request(Endpoint.SPA_CONNECT_STATUS)
|
|
283
|
+
model_res = await self._safe_request(Endpoint.SPA_MODEL)
|
|
249
284
|
|
|
250
|
-
|
|
251
|
-
self.spa
|
|
252
|
-
|
|
253
|
-
|
|
285
|
+
with _parsing(Endpoint.STATUS):
|
|
286
|
+
if self.spa is None:
|
|
287
|
+
self.spa = Spa(status_res)
|
|
288
|
+
else:
|
|
289
|
+
self.spa.update_from_dict(status_res)
|
|
254
290
|
|
|
255
291
|
if startup_res:
|
|
256
|
-
|
|
292
|
+
with _parsing(Endpoint.STARTUP):
|
|
293
|
+
self.spa.update_info(startup_res)
|
|
257
294
|
|
|
258
295
|
if model_res:
|
|
259
|
-
|
|
296
|
+
with _parsing(Endpoint.SPA_MODEL):
|
|
297
|
+
self.spa.update_info(model_res)
|
|
260
298
|
|
|
261
299
|
if connect_res:
|
|
262
|
-
|
|
300
|
+
with _parsing(Endpoint.SPA_CONNECT_STATUS):
|
|
301
|
+
self.spa.update_connection_status(connect_res)
|
|
263
302
|
elif (
|
|
264
303
|
self.spa.connection_status
|
|
265
304
|
and not self.spa.connection_status.spa_connected
|
|
@@ -278,16 +317,18 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
278
317
|
self._identity_loaded = True
|
|
279
318
|
return self.spa
|
|
280
319
|
|
|
281
|
-
status_res = await self.request(
|
|
282
|
-
connect_res = await self._safe_request(
|
|
320
|
+
status_res = await self.request(Endpoint.STATUS)
|
|
321
|
+
connect_res = await self._safe_request(Endpoint.SPA_CONNECT_STATUS)
|
|
283
322
|
|
|
284
|
-
|
|
285
|
-
self.spa
|
|
286
|
-
|
|
287
|
-
|
|
323
|
+
with _parsing(Endpoint.STATUS):
|
|
324
|
+
if self.spa is None: # Safety guard; spa is always set after cold sync
|
|
325
|
+
self.spa = Spa(status_res)
|
|
326
|
+
else:
|
|
327
|
+
self.spa.update_from_dict(status_res)
|
|
288
328
|
|
|
289
329
|
if connect_res:
|
|
290
|
-
|
|
330
|
+
with _parsing(Endpoint.SPA_CONNECT_STATUS):
|
|
331
|
+
self.spa.update_connection_status(connect_res)
|
|
291
332
|
elif (
|
|
292
333
|
self.spa.connection_status and not self.spa.connection_status.spa_connected
|
|
293
334
|
):
|
|
@@ -312,8 +353,7 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
312
353
|
HotSpringError: If the response is invalid.
|
|
313
354
|
|
|
314
355
|
"""
|
|
315
|
-
|
|
316
|
-
return SpaInfo.from_dict(data)
|
|
356
|
+
return await self._fetch(Endpoint.STARTUP, SpaInfo.from_dict)
|
|
317
357
|
|
|
318
358
|
async def update_identity(self) -> SpaInfo:
|
|
319
359
|
"""Fetch and update static spa identity info (/startup and /spamodel).
|
|
@@ -333,8 +373,8 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
333
373
|
msg = "Call update() before update_identity()"
|
|
334
374
|
raise HotSpringError(msg)
|
|
335
375
|
|
|
336
|
-
startup_res = await self._safe_request(
|
|
337
|
-
model_res = await self._safe_request(
|
|
376
|
+
startup_res = await self._safe_request(Endpoint.STARTUP)
|
|
377
|
+
model_res = await self._safe_request(Endpoint.SPA_MODEL)
|
|
338
378
|
|
|
339
379
|
identity_data: dict[str, object] = {}
|
|
340
380
|
if startup_res:
|
|
@@ -343,7 +383,8 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
343
383
|
identity_data.update(model_res)
|
|
344
384
|
|
|
345
385
|
if identity_data:
|
|
346
|
-
|
|
386
|
+
with _parsing(f"{Endpoint.STARTUP} and {Endpoint.SPA_MODEL}"):
|
|
387
|
+
self.spa.update_info(identity_data)
|
|
347
388
|
|
|
348
389
|
if self.validate_device and not self.spa.is_hna:
|
|
349
390
|
msg = (
|
|
@@ -372,14 +413,15 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
372
413
|
HotSpringError: If no data is returned.
|
|
373
414
|
|
|
374
415
|
"""
|
|
375
|
-
data = await self.request("/getFWIQData")
|
|
376
416
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
417
|
+
def parse(data: dict[str, object]) -> FreshWaterIQ:
|
|
418
|
+
if self.spa is None:
|
|
419
|
+
msg = "Call update() before update_water_care()"
|
|
420
|
+
raise HotSpringError(msg)
|
|
421
|
+
self.spa.update_freshwater_iq(data)
|
|
422
|
+
return self.spa.freshwater_iq
|
|
380
423
|
|
|
381
|
-
self.
|
|
382
|
-
return self.spa.freshwater_iq
|
|
424
|
+
return await self._fetch(Endpoint.FRESHWATER_IQ, parse)
|
|
383
425
|
|
|
384
426
|
async def update_diagnostics(self) -> Diagnostics:
|
|
385
427
|
"""Update diagnostic and power metrics.
|
|
@@ -396,14 +438,15 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
396
438
|
HotSpringError: If no data is returned.
|
|
397
439
|
|
|
398
440
|
"""
|
|
399
|
-
data = await self.request("/addDebugData")
|
|
400
441
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
442
|
+
def parse(data: dict[str, object]) -> Diagnostics:
|
|
443
|
+
if self.spa is None:
|
|
444
|
+
msg = "Call update() before update_diagnostics()"
|
|
445
|
+
raise HotSpringError(msg)
|
|
446
|
+
self.spa.update_diagnostics(data)
|
|
447
|
+
return self.spa.diagnostics
|
|
404
448
|
|
|
405
|
-
self.
|
|
406
|
-
return self.spa.diagnostics
|
|
449
|
+
return await self._fetch(Endpoint.DEBUG_DATA, parse)
|
|
407
450
|
|
|
408
451
|
async def update_connection_status(self) -> ConnectionStatus:
|
|
409
452
|
"""Update HNA/SNA/cloud connection status.
|
|
@@ -417,14 +460,20 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
417
460
|
HotSpringError: If no data is returned.
|
|
418
461
|
|
|
419
462
|
"""
|
|
420
|
-
data = await self.request("/spaConnectStatus")
|
|
421
463
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
464
|
+
def parse(data: dict[str, object]) -> ConnectionStatus:
|
|
465
|
+
if self.spa is None:
|
|
466
|
+
msg = "Call update() before update_connection_status()"
|
|
467
|
+
raise HotSpringError(msg)
|
|
468
|
+
self.spa.update_connection_status(data)
|
|
469
|
+
return self.spa.connection_status
|
|
470
|
+
|
|
471
|
+
return await self._fetch(Endpoint.SPA_CONNECT_STATUS, parse)
|
|
425
472
|
|
|
426
|
-
|
|
427
|
-
|
|
473
|
+
def _apply_command_response(self, response: dict[str, object]) -> None:
|
|
474
|
+
"""Fold a command's echoed state into the spa, if one is loaded."""
|
|
475
|
+
if self.spa is not None:
|
|
476
|
+
self.spa.update_from_dict(response)
|
|
428
477
|
|
|
429
478
|
async def _send_command(self, payload: dict[str, object]) -> None:
|
|
430
479
|
"""Send a control command to the spa via POST /spaManager.
|
|
@@ -444,7 +493,9 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
444
493
|
Raises:
|
|
445
494
|
------
|
|
446
495
|
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
447
|
-
|
|
496
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
497
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
498
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
448
499
|
|
|
449
500
|
"""
|
|
450
501
|
if self.spa is not None and not self.spa.connection_status.spa_connected:
|
|
@@ -455,13 +506,16 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
455
506
|
raise HotSpringNotReadyError(msg)
|
|
456
507
|
|
|
457
508
|
try:
|
|
458
|
-
|
|
459
|
-
|
|
509
|
+
await self._fetch(
|
|
510
|
+
Endpoint.SPA_MANAGER,
|
|
511
|
+
self._apply_command_response,
|
|
512
|
+
method=HTTPMethod.POST,
|
|
513
|
+
data=payload,
|
|
460
514
|
)
|
|
461
|
-
|
|
462
|
-
|
|
515
|
+
except HotSpringConnectionError:
|
|
516
|
+
raise
|
|
463
517
|
except HotSpringError as exception:
|
|
464
|
-
msg = f"Command failed: {payload}"
|
|
518
|
+
msg = f"Command failed: {payload}: {exception}"
|
|
465
519
|
raise HotSpringCommandError(msg) from exception
|
|
466
520
|
|
|
467
521
|
async def set_temperature(self, temperature: float) -> None:
|
|
@@ -472,6 +526,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
472
526
|
temperature: Target temperature in the spa's configured unit
|
|
473
527
|
(Fahrenheit or Celsius). Supports integer or half-degree float values.
|
|
474
528
|
|
|
529
|
+
Raises:
|
|
530
|
+
------
|
|
531
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
532
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
533
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
534
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
535
|
+
|
|
475
536
|
"""
|
|
476
537
|
await self._send_command(
|
|
477
538
|
{"heater": {"control": {"temperatureABS": str(temperature)}}}
|
|
@@ -485,6 +546,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
485
546
|
mode: The heating mode value. Use HeatingMode enum values or string,
|
|
486
547
|
e.g. ``HeatingMode.HEAT_WITH_BOOST.value`` or ``"heatWithBoost"``.
|
|
487
548
|
|
|
549
|
+
Raises:
|
|
550
|
+
------
|
|
551
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
552
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
553
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
554
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
555
|
+
|
|
488
556
|
"""
|
|
489
557
|
mode_val = mode.value if isinstance(mode, HeatingMode) else str(mode)
|
|
490
558
|
await self._send_command({"heater": {"control": {"heatingMode": mode_val}}})
|
|
@@ -498,6 +566,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
498
566
|
speed: The speed value. Use JetSpeed enum values or string,
|
|
499
567
|
e.g. ``JetSpeed.HIGH_SPEED.value`` or ``"highSpeed"``.
|
|
500
568
|
|
|
569
|
+
Raises:
|
|
570
|
+
------
|
|
571
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
572
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
573
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
574
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
575
|
+
|
|
501
576
|
"""
|
|
502
577
|
speed_val = speed.value if isinstance(speed, JetSpeed) else str(speed)
|
|
503
578
|
await self._send_command({"JET": {f"JET{jet}": {"control": speed_val}}})
|
|
@@ -515,6 +590,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
515
590
|
color: The color value. Use LightColor enum values or string,
|
|
516
591
|
e.g. ``LightColor.BLUE.value`` or ``"BLUE"``.
|
|
517
592
|
|
|
593
|
+
Raises:
|
|
594
|
+
------
|
|
595
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
596
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
597
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
598
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
599
|
+
|
|
518
600
|
"""
|
|
519
601
|
color_val = color.value if isinstance(color, LightColor) else str(color)
|
|
520
602
|
await self._send_command(
|
|
@@ -538,6 +620,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
538
620
|
----
|
|
539
621
|
zone: The light zone number (1-based).
|
|
540
622
|
|
|
623
|
+
Raises:
|
|
624
|
+
------
|
|
625
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
626
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
627
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
628
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
629
|
+
|
|
541
630
|
"""
|
|
542
631
|
await self._send_command(
|
|
543
632
|
{
|
|
@@ -564,6 +653,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
564
653
|
Raises:
|
|
565
654
|
------
|
|
566
655
|
ValueError: If brightness is not an integer between 0 and 5.
|
|
656
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
657
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
658
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
659
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
567
660
|
|
|
568
661
|
"""
|
|
569
662
|
if not 0 <= brightness <= 5:
|
|
@@ -598,6 +691,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
598
691
|
e.g. ``LightWheelMode.ON.value``, ``"loopUp"``,
|
|
599
692
|
``"loopDown"``, or ``"off"``. Defaults to LightWheelMode.ON.
|
|
600
693
|
|
|
694
|
+
Raises:
|
|
695
|
+
------
|
|
696
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
697
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
698
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
699
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
700
|
+
|
|
601
701
|
"""
|
|
602
702
|
mode_val = mode.value if isinstance(mode, LightWheelMode) else str(mode)
|
|
603
703
|
await self._send_command(
|
|
@@ -633,6 +733,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
633
733
|
Raises:
|
|
634
734
|
------
|
|
635
735
|
ValueError: If any RGB component is not between 0 and 255.
|
|
736
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
737
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
738
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
739
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
636
740
|
|
|
637
741
|
"""
|
|
638
742
|
for component in (red, green, blue):
|
|
@@ -668,6 +772,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
668
772
|
----
|
|
669
773
|
enabled: True to enable, False to disable.
|
|
670
774
|
|
|
775
|
+
Raises:
|
|
776
|
+
------
|
|
777
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
778
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
779
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
780
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
781
|
+
|
|
671
782
|
"""
|
|
672
783
|
value = "on" if enabled else "off"
|
|
673
784
|
await self._send_command({"cleanCycle": {"control": {"cleanCycle": value}}})
|
|
@@ -679,6 +790,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
679
790
|
----
|
|
680
791
|
on: True to turn on, False to turn off.
|
|
681
792
|
|
|
793
|
+
Raises:
|
|
794
|
+
------
|
|
795
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
796
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
797
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
798
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
799
|
+
|
|
682
800
|
"""
|
|
683
801
|
value = "on" if on else "off"
|
|
684
802
|
await self._send_command({"blower": {"control": value}})
|
|
@@ -690,6 +808,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
690
808
|
----
|
|
691
809
|
locked: True to lock, False to unlock.
|
|
692
810
|
|
|
811
|
+
Raises:
|
|
812
|
+
------
|
|
813
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
814
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
815
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
816
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
817
|
+
|
|
693
818
|
"""
|
|
694
819
|
value = "on" if locked else "off"
|
|
695
820
|
await self._send_command({"spaLock": {"control": value}})
|
|
@@ -701,6 +826,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
701
826
|
----
|
|
702
827
|
locked: True to lock, False to unlock.
|
|
703
828
|
|
|
829
|
+
Raises:
|
|
830
|
+
------
|
|
831
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
832
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
833
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
834
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
835
|
+
|
|
704
836
|
"""
|
|
705
837
|
value = "on" if locked else "off"
|
|
706
838
|
await self._send_command({"heater": {"control": {"temperatureLock": value}}})
|
|
@@ -716,6 +848,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
716
848
|
----
|
|
717
849
|
enabled: True to enable, False to disable.
|
|
718
850
|
|
|
851
|
+
Raises:
|
|
852
|
+
------
|
|
853
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
854
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
855
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
856
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
857
|
+
|
|
719
858
|
"""
|
|
720
859
|
value = "on" if enabled else "off"
|
|
721
860
|
await self._send_command({"cleanCycle": {"control": {"vanishingAct": value}}})
|
|
@@ -728,6 +867,13 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
728
867
|
The underlying ESP32 firmware endpoint only supports toggling
|
|
729
868
|
the boost state via ``{"waterCare": {"control": {"boost": "toggle"}}}``.
|
|
730
869
|
|
|
870
|
+
Raises:
|
|
871
|
+
------
|
|
872
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
873
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
874
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
875
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
876
|
+
|
|
731
877
|
"""
|
|
732
878
|
await self._send_command({"waterCare": {"control": {"boost": "toggle"}}})
|
|
733
879
|
|
|
@@ -745,6 +891,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
745
891
|
Raises:
|
|
746
892
|
------
|
|
747
893
|
ValueError: If level is not an integer between 0 and 10.
|
|
894
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
895
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
896
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
897
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
748
898
|
|
|
749
899
|
"""
|
|
750
900
|
if not 0 <= level <= 10:
|
|
@@ -768,6 +918,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
768
918
|
Raises:
|
|
769
919
|
------
|
|
770
920
|
ValueError: If neither power_a nor power_b is specified.
|
|
921
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
922
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
923
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
924
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
771
925
|
|
|
772
926
|
"""
|
|
773
927
|
cfg: dict[str, object] = {}
|
|
@@ -791,6 +945,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
791
945
|
Raises:
|
|
792
946
|
------
|
|
793
947
|
ValueError: If the brightness level is unrecognized.
|
|
948
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
949
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
950
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
951
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
794
952
|
|
|
795
953
|
"""
|
|
796
954
|
brightness = (
|
|
@@ -830,6 +988,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
830
988
|
Raises:
|
|
831
989
|
------
|
|
832
990
|
ValueError: If schedule_id or time/duration parameters are invalid.
|
|
991
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
992
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
993
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
994
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
833
995
|
|
|
834
996
|
"""
|
|
835
997
|
if schedule_id not in VALID_ENERGY_SAVING_SCHEDULE_IDS:
|
|
@@ -884,6 +1046,10 @@ class HotSpring: # pylint: disable=too-many-public-methods
|
|
|
884
1046
|
Raises:
|
|
885
1047
|
------
|
|
886
1048
|
ValueError: If time parameters are out of range.
|
|
1049
|
+
HotSpringNotReadyError: If the SNA bridge is not connected.
|
|
1050
|
+
HotSpringConnectionTimeoutError: If the command times out.
|
|
1051
|
+
HotSpringConnectionError: If the HNA cannot be reached.
|
|
1052
|
+
HotSpringCommandError: If the command fails for any other reason.
|
|
887
1053
|
|
|
888
1054
|
"""
|
|
889
1055
|
if not 0 <= start_hour <= 23:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|