python-izone 1.3.4__py3-none-any.whl → 1.3.5__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 CHANGED
@@ -1,7 +1,9 @@
1
1
  """Interface to the iZone air conditioner controller.
2
2
 
3
- Interaction is mostly through the :class:`~pizone.controller.Controller` and
4
- :class:`~pizone.zone.Zone` classes.
3
+ Prefer :func:`~pizone.discovery.create_discovery` or
4
+ :func:`~pizone.discovery.discovery` to obtain a discovery service, then create
5
+ or discover :class:`~pizone.controller.Controller` instances through that
6
+ service. Zones and power monitors are owned by their controller.
5
7
 
6
8
  Synchronous property reads return cached device data and do not raise
7
9
  :exc:`ConnectionError`. Async command and refresh methods perform HTTP I/O and
@@ -14,25 +16,64 @@ Layered connection state on :class:`~pizone.controller.Controller`:
14
16
  - :attr:`~pizone.controller.Controller.bridge_connected` — ASH bridge HTTP transport
15
17
  - :attr:`~pizone.controller.Controller.connected` — bridge plus valid iZone AC data
16
18
  - :attr:`~pizone.power.Power.connected` — power monitor I/O (when enabled)
19
+
20
+ Power support is off by default. Enable at runtime before create/refresh when
21
+ the consumer needs iPower (for example future Home Assistant power entities)::
22
+
23
+ import pizone
24
+ pizone.ENABLE_POWER = True
17
25
  """
18
26
 
27
+ import sys
28
+ from types import ModuleType
29
+ from typing import Any
30
+
31
+ from . import power as power_mod
32
+ from .const import PLACEHOLDER_DEVICE_UID
19
33
  from .controller import Controller
20
- from .discovery import DiscoveryService, Listener, discovery
21
- from .exceptions import ControllerCommandError, ResponseDecodeError
34
+ from .discovery import DiscoveryService, Listener, create_discovery, discovery
35
+ from .exceptions import ControllerCommandError, ResponseDecodeError, UnpairedBridgeError
22
36
  from .power import BatteryLevel, Power, PowerChannel, PowerDevice, PowerGroup
37
+ from .types import ControllerEndpoint
23
38
  from .zone import Zone
24
39
 
40
+
41
+ def __getattr__(name: str) -> Any:
42
+ if name == "ENABLE_POWER":
43
+ return power_mod.ENABLE_POWER
44
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
45
+
46
+
47
+ class _PizoneModule(ModuleType):
48
+ """Allow ``pizone.ENABLE_POWER = True`` to update :mod:`pizone.power`."""
49
+
50
+ @property
51
+ def ENABLE_POWER(self) -> bool:
52
+ return power_mod.ENABLE_POWER
53
+
54
+ @ENABLE_POWER.setter
55
+ def ENABLE_POWER(self, value: bool) -> None:
56
+ power_mod.ENABLE_POWER = bool(value)
57
+
58
+
59
+ sys.modules[__name__].__class__ = _PizoneModule
60
+
25
61
  __all__ = [
62
+ "ENABLE_POWER",
63
+ "PLACEHOLDER_DEVICE_UID",
64
+ "BatteryLevel",
26
65
  "Controller",
27
66
  "ControllerCommandError",
28
- "ResponseDecodeError",
29
- "Zone",
67
+ "ControllerEndpoint",
30
68
  "DiscoveryService",
31
69
  "Listener",
32
- "discovery",
33
70
  "Power",
34
- "PowerGroup",
35
- "PowerDevice",
36
71
  "PowerChannel",
37
- "BatteryLevel",
72
+ "PowerDevice",
73
+ "PowerGroup",
74
+ "ResponseDecodeError",
75
+ "UnpairedBridgeError",
76
+ "Zone",
77
+ "create_discovery",
78
+ "discovery",
38
79
  ]
pizone/const.py ADDED
@@ -0,0 +1,4 @@
1
+ """Shared constants for pizone."""
2
+
3
+ # Exact AirStreamDeviceUId when an ASH bridge has no paired AC (desk evidence).
4
+ PLACEHOLDER_DEVICE_UID = "000000000"