python-izone 1.3.6__py3-none-any.whl → 1.3.7__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.
- pizone/__init__.py +7 -1
- pizone/discovery.py +10 -6
- pizone/exceptions.py +8 -0
- pizone/version.py +2 -2
- {python_izone-1.3.6.dist-info → python_izone-1.3.7.dist-info}/METADATA +1 -1
- python_izone-1.3.7.dist-info/RECORD +14 -0
- python_izone-1.3.6.dist-info/RECORD +0 -14
- {python_izone-1.3.6.dist-info → python_izone-1.3.7.dist-info}/WHEEL +0 -0
- {python_izone-1.3.6.dist-info → python_izone-1.3.7.dist-info}/licenses/licence.txt +0 -0
pizone/__init__.py
CHANGED
|
@@ -31,7 +31,12 @@ from typing import Any
|
|
|
31
31
|
from . import power as power_mod
|
|
32
32
|
from .controller import Controller
|
|
33
33
|
from .discovery import DiscoveryService, Listener, create_discovery, discovery
|
|
34
|
-
from .exceptions import
|
|
34
|
+
from .exceptions import (
|
|
35
|
+
ControllerAlreadyClaimedError,
|
|
36
|
+
ControllerCommandError,
|
|
37
|
+
ResponseDecodeError,
|
|
38
|
+
UnpairedBridgeError,
|
|
39
|
+
)
|
|
35
40
|
from .power import BatteryLevel, Power, PowerChannel, PowerDevice, PowerGroup
|
|
36
41
|
from .types import ControllerEndpoint
|
|
37
42
|
from .zone import Zone
|
|
@@ -61,6 +66,7 @@ __all__ = [
|
|
|
61
66
|
"ENABLE_POWER",
|
|
62
67
|
"BatteryLevel",
|
|
63
68
|
"Controller",
|
|
69
|
+
"ControllerAlreadyClaimedError",
|
|
64
70
|
"ControllerCommandError",
|
|
65
71
|
"ControllerEndpoint",
|
|
66
72
|
"DiscoveryService",
|
pizone/discovery.py
CHANGED
|
@@ -24,7 +24,7 @@ import ifaddr
|
|
|
24
24
|
|
|
25
25
|
from .const import PLACEHOLDER_DEVICE_UID
|
|
26
26
|
from .controller import Controller
|
|
27
|
-
from .exceptions import raise_if_placeholder_uid
|
|
27
|
+
from .exceptions import ControllerAlreadyClaimedError, raise_if_placeholder_uid
|
|
28
28
|
from .types import ControllerEndpoint
|
|
29
29
|
from .zone import Zone
|
|
30
30
|
|
|
@@ -405,7 +405,9 @@ class DiscoveryService:
|
|
|
405
405
|
def _ensure_endpoint_available(self, endpoint: ControllerEndpoint) -> None:
|
|
406
406
|
"""Raise if *endpoint* is already claimed."""
|
|
407
407
|
if endpoint.uid in self._claimed_endpoints:
|
|
408
|
-
raise
|
|
408
|
+
raise ControllerAlreadyClaimedError(
|
|
409
|
+
f"Controller {endpoint.uid} already created"
|
|
410
|
+
)
|
|
409
411
|
|
|
410
412
|
# disposition: 1.4
|
|
411
413
|
def _claim_endpoint(self, endpoint: ControllerEndpoint) -> None:
|
|
@@ -451,7 +453,9 @@ class DiscoveryService:
|
|
|
451
453
|
"""
|
|
452
454
|
claimed = self._endpoint_by_host(self._claimed_endpoints, host)
|
|
453
455
|
if claimed is not None:
|
|
454
|
-
raise
|
|
456
|
+
raise ControllerAlreadyClaimedError(
|
|
457
|
+
f"Controller {claimed.uid} already created"
|
|
458
|
+
)
|
|
455
459
|
known = self._endpoint_by_host(self._known_endpoints, host)
|
|
456
460
|
if known is not None:
|
|
457
461
|
return known
|
|
@@ -476,7 +480,7 @@ class DiscoveryService:
|
|
|
476
480
|
"""
|
|
477
481
|
raise_if_placeholder_uid(uid)
|
|
478
482
|
if uid in self._claimed_endpoints:
|
|
479
|
-
raise
|
|
483
|
+
raise ControllerAlreadyClaimedError(f"Controller {uid} already created")
|
|
480
484
|
endpoint = self._known_endpoints.get(uid)
|
|
481
485
|
if endpoint is not None:
|
|
482
486
|
return endpoint
|
|
@@ -569,7 +573,7 @@ class DiscoveryService:
|
|
|
569
573
|
|
|
570
574
|
Raises:
|
|
571
575
|
UnpairedBridgeError: If *uid* is the unpaired placeholder (no I/O).
|
|
572
|
-
|
|
576
|
+
ControllerAlreadyClaimedError: If a controller with *uid* already exists.
|
|
573
577
|
ConnectionError: If the controller cannot be reached after
|
|
574
578
|
address fallback.
|
|
575
579
|
ControllerCommandError: If the device rejects the protocol request.
|
|
@@ -579,7 +583,7 @@ class DiscoveryService:
|
|
|
579
583
|
"""
|
|
580
584
|
raise_if_placeholder_uid(uid)
|
|
581
585
|
if uid in self._claimed_endpoints:
|
|
582
|
-
raise
|
|
586
|
+
raise ControllerAlreadyClaimedError(f"Controller {uid} already created")
|
|
583
587
|
pending_address_changed: ControllerEndpoint | None = None
|
|
584
588
|
|
|
585
589
|
try:
|
pizone/exceptions.py
CHANGED
|
@@ -28,6 +28,14 @@ class UnpairedBridgeError(ValueError):
|
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
class ControllerAlreadyClaimedError(Exception):
|
|
32
|
+
"""A controller UID or host is already claimed on this discovery service.
|
|
33
|
+
|
|
34
|
+
Raised when ``discover_by_host``, ``discover_by_uid``, or ``create_controller``
|
|
35
|
+
would duplicate an active controller registration.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
|
|
31
39
|
def raise_if_placeholder_uid(uid: str) -> None:
|
|
32
40
|
"""Raise :exc:`UnpairedBridgeError` if *uid* is the unpaired placeholder."""
|
|
33
41
|
if uid == PLACEHOLDER_DEVICE_UID:
|
pizone/version.py
CHANGED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.3.
|
|
22
|
-
__version_tuple__ = version_tuple = (1, 3,
|
|
21
|
+
__version__ = version = '1.3.7'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 3, 7)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
pizone/__init__.py,sha256=9EbQzqD1XfS5fSE-zgFieuzxAfZcQb9a3wNXsMp0JKc,2644
|
|
2
|
+
pizone/const.py,sha256=0skTh6zBe61AJ_57fqdBrxz3aVBM3T4Ak_cPSkOx2Bo,153
|
|
3
|
+
pizone/controller.py,sha256=nctzAF8Y75T0_Ue9Hxxv9OfEex4zoNseOMjGfI6wHFE,41109
|
|
4
|
+
pizone/discovery.py,sha256=9akqPwsB8gcsmqnT5GQ3CCilo4m3jYL7cA3MWFOU1Uc,37442
|
|
5
|
+
pizone/exceptions.py,sha256=qzYNHzQBMDcuvLfxlvOsk6J2Lp0gtzlHqJWpzyEunvU,1603
|
|
6
|
+
pizone/power.py,sha256=bXoDRVD6gCfq0kJv132sjfy13DHGd6p2uBg9HcxRSxA,10343
|
|
7
|
+
pizone/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
pizone/types.py,sha256=fZrnec0Q815HyG2sFciLqNX0QDbTq1_0wTF92GXQh78,200
|
|
9
|
+
pizone/version.py,sha256=qggYsfTliS2fgO5WngEhVPgiQ-AREJyDah_xDSuzcIM,520
|
|
10
|
+
pizone/zone.py,sha256=tqiLJAJCmp1cehCtVPjawUNY9qyYypC4x3igI5jtDNo,7446
|
|
11
|
+
python_izone-1.3.7.dist-info/METADATA,sha256=t1FnN14YONJRs8bYY-sNsbADvzt6VaQbQLfOGlzCzDQ,2703
|
|
12
|
+
python_izone-1.3.7.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
13
|
+
python_izone-1.3.7.dist-info/licenses/licence.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
14
|
+
python_izone-1.3.7.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
pizone/__init__.py,sha256=yJMEJCKBU0mYOuvvBZFG5NTkpMpMWBAg9MvmzP3npK8,2555
|
|
2
|
-
pizone/const.py,sha256=0skTh6zBe61AJ_57fqdBrxz3aVBM3T4Ak_cPSkOx2Bo,153
|
|
3
|
-
pizone/controller.py,sha256=nctzAF8Y75T0_Ue9Hxxv9OfEex4zoNseOMjGfI6wHFE,41109
|
|
4
|
-
pizone/discovery.py,sha256=C9AEK6nMyo2xU-jZ3BWyADnTMM-X1EkgNh9LaECkpBc,37266
|
|
5
|
-
pizone/exceptions.py,sha256=wRO-COpyNyKL6P1vG0MlAVwbwo2iOvH0kRO7O75PUlo,1327
|
|
6
|
-
pizone/power.py,sha256=bXoDRVD6gCfq0kJv132sjfy13DHGd6p2uBg9HcxRSxA,10343
|
|
7
|
-
pizone/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
pizone/types.py,sha256=fZrnec0Q815HyG2sFciLqNX0QDbTq1_0wTF92GXQh78,200
|
|
9
|
-
pizone/version.py,sha256=_FUKw5XE-1Iz4eIZxskUWzdnDjBxzXHPurN7TvxgxV8,520
|
|
10
|
-
pizone/zone.py,sha256=tqiLJAJCmp1cehCtVPjawUNY9qyYypC4x3igI5jtDNo,7446
|
|
11
|
-
python_izone-1.3.6.dist-info/METADATA,sha256=nv6-HMl-Py3IKlUPtstcKfpEz1LbsmOZGF1P0oOy8ao,2703
|
|
12
|
-
python_izone-1.3.6.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
13
|
-
python_izone-1.3.6.dist-info/licenses/licence.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
14
|
-
python_izone-1.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|