python-izone 1.3.11__tar.gz → 2.0.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.
Files changed (71) hide show
  1. {python_izone-1.3.11 → python_izone-2.0.0}/.pre-commit-config.yaml +1 -1
  2. {python_izone-1.3.11 → python_izone-2.0.0}/PKG-INFO +16 -3
  3. {python_izone-1.3.11 → python_izone-2.0.0}/README.md +15 -2
  4. python_izone-2.0.0/docs/release-notes/v1.3.12.md +23 -0
  5. python_izone-2.0.0/docs/release-notes/v2.0.0.md +146 -0
  6. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/__init__.py +19 -8
  7. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/controller.py +226 -435
  8. python_izone-2.0.0/pizone/discovery.py +1075 -0
  9. python_izone-2.0.0/pizone/exceptions.py +92 -0
  10. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/power.py +0 -3
  11. python_izone-2.0.0/pizone/types.py +92 -0
  12. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/v2.py +44 -15
  13. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/version.py +2 -2
  14. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/zone.py +110 -27
  15. {python_izone-1.3.11 → python_izone-2.0.0}/pyproject.toml +9 -3
  16. {python_izone-1.3.11 → python_izone-2.0.0}/scripts/izone_v1_probe.py +165 -132
  17. {python_izone-1.3.11 → python_izone-2.0.0}/tests/conftest.py +74 -89
  18. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_control_zone.py +25 -2
  19. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_controller.py +287 -287
  20. python_izone-2.0.0/tests/test_discovery.py +302 -0
  21. python_izone-2.0.0/tests/test_discovery_api.py +1825 -0
  22. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_dump_state.py +6 -10
  23. python_izone-2.0.0/tests/test_hardware_controller.py +234 -0
  24. python_izone-2.0.0/tests/test_hardware_hosts.py +161 -0
  25. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_http.py +18 -40
  26. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_power.py +0 -21
  27. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_v2.py +102 -5
  28. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_v2_confirmation.py +3 -4
  29. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_v2_vendor_enums.py +1 -1
  30. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_v2_zone_validation.py +3 -4
  31. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_zone.py +141 -75
  32. {python_izone-1.3.11 → python_izone-2.0.0}/tests/v2_fixtures.py +67 -3
  33. python_izone-2.0.0/uv.lock +880 -0
  34. python_izone-1.3.11/pizone/discovery.py +0 -1125
  35. python_izone-1.3.11/pizone/exceptions.py +0 -45
  36. python_izone-1.3.11/pizone/types.py +0 -26
  37. python_izone-1.3.11/tests/test_discovery.py +0 -641
  38. python_izone-1.3.11/tests/test_discovery_api.py +0 -1013
  39. python_izone-1.3.11/tests/test_fullstack.py +0 -247
  40. python_izone-1.3.11/uv.lock +0 -685
  41. {python_izone-1.3.11 → python_izone-2.0.0}/.gitattributes +0 -0
  42. {python_izone-1.3.11 → python_izone-2.0.0}/.github/workflows/main.yml +0 -0
  43. {python_izone-1.3.11 → python_izone-2.0.0}/.gitignore +0 -0
  44. {python_izone-1.3.11 → python_izone-2.0.0}/.python-version +0 -0
  45. {python_izone-1.3.11 → python_izone-2.0.0}/.vscode/.ropeproject/config.py +0 -0
  46. {python_izone-1.3.11 → python_izone-2.0.0}/.vscode/extensions.json +0 -0
  47. {python_izone-1.3.11 → python_izone-2.0.0}/.vscode/launch.json +0 -0
  48. {python_izone-1.3.11 → python_izone-2.0.0}/.vscode/settings.json +0 -0
  49. {python_izone-1.3.11 → python_izone-2.0.0}/api_docs/AC-DOC-1401-11_iZoneEthernetInterface.pdf +0 -0
  50. {python_izone-1.3.11 → python_izone-2.0.0}/api_docs/iPower_JSON_datastrings_Out.h +0 -0
  51. {python_izone-1.3.11 → python_izone-2.0.0}/api_docs/iZone_JSON_datastrings.h +0 -0
  52. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.10.md +0 -0
  53. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.11.md +0 -0
  54. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.4.md +0 -0
  55. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.5.md +0 -0
  56. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.6.md +0 -0
  57. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.7.md +0 -0
  58. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.8.md +0 -0
  59. {python_izone-1.3.11 → python_izone-2.0.0}/docs/release-notes/v1.3.9.md +0 -0
  60. {python_izone-1.3.11 → python_izone-2.0.0}/docs/v2-confirmation.md +0 -0
  61. {python_izone-1.3.11 → python_izone-2.0.0}/licence.txt +0 -0
  62. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/const.py +0 -0
  63. {python_izone-1.3.11 → python_izone-2.0.0}/pizone/py.typed +0 -0
  64. {python_izone-1.3.11 → python_izone-2.0.0}/scripts/check +0 -0
  65. {python_izone-1.3.11 → python_izone-2.0.0}/scripts/coverage +0 -0
  66. {python_izone-1.3.11 → python_izone-2.0.0}/tests/__init__.py +0 -0
  67. {python_izone-1.3.11 → python_izone-2.0.0}/tests/http_fakes.py +0 -0
  68. {python_izone-1.3.11 → python_izone-2.0.0}/tests/power_data.py +0 -0
  69. {python_izone-1.3.11 → python_izone-2.0.0}/tests/resources.py +0 -0
  70. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_discovery_close_timeout.py +0 -0
  71. {python_izone-1.3.11 → python_izone-2.0.0}/tests/test_v2_fan_capability.py +0 -0
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/astral-sh/ruff-pre-commit
3
- rev: v0.15.21
3
+ rev: v0.17.3
4
4
  hooks:
5
5
  - id: ruff-check
6
6
  args: [--fix]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-izone
3
- Version: 1.3.11
3
+ Version: 2.0.0
4
4
  Summary: A python interface to the iZone airconditioner controller
5
5
  Project-URL: Homepage, https://github.com/Swamp-Ig/pizone
6
6
  Author-email: Penny Wood <pypl@ninjateaparty.com>
@@ -45,7 +45,9 @@ Synchronous property reads return cached device data and do not raise
45
45
  `ConnectionError`. Async command and refresh methods perform HTTP I/O and
46
46
  raise `ConnectionError` when the device cannot be reached. They raise
47
47
  `ControllerCommandError` when the device responds but rejects the request
48
- (`{ERROR}` body or HTTP 4xx).
48
+ (`{ERROR}` body or HTTP 4xx). Setters raise `InvalidValueError` before any
49
+ I/O when a value is out of range, off its step, or not supported by the system
50
+ or zone. It subclasses both `ValueError` and `AttributeError`.
49
51
 
50
52
  ## Dependencies
51
53
 
@@ -63,6 +65,14 @@ The iZone Ethernet interface is documented in
63
65
  If Home Assistant can load the iZone integration, prefer **Download diagnostics**
64
66
  from the integration page.
65
67
 
68
+ A bridge is only reported as found once it answers over HTTP. When one replies
69
+ to discovery but fails that check, the library says why: `discover_all()`
70
+ lists it in the result's `unverified`, and `discover_by_host()` /
71
+ `discover_by_uid()` raise `EndpointVerifyError` with a `VerifyFailure` reason
72
+ (no HTTP reply, unreadable reply, a different UID, or a host name that didn't
73
+ resolve). Failures during background discovery are logged at debug level on
74
+ the `pizone.discovery` logger.
75
+
66
76
  When that is not possible (or you need a live HTTP/UDP survey of the bridge),
67
77
  run the stdlib probe from a machine on the same LAN:
68
78
 
@@ -96,5 +106,8 @@ Individual commands:
96
106
  To run integration tests against a controller on your network:
97
107
 
98
108
  ```bash
99
- uv run pytest tests/test_fullstack.py -m hardware -o addopts=
109
+ uv run pytest -m hardware -o addopts=
100
110
  ```
111
+
112
+ They bind UDP port 7005, so stop Home Assistant or anything else using iZone
113
+ discovery on the same machine first.
@@ -19,7 +19,9 @@ Synchronous property reads return cached device data and do not raise
19
19
  `ConnectionError`. Async command and refresh methods perform HTTP I/O and
20
20
  raise `ConnectionError` when the device cannot be reached. They raise
21
21
  `ControllerCommandError` when the device responds but rejects the request
22
- (`{ERROR}` body or HTTP 4xx).
22
+ (`{ERROR}` body or HTTP 4xx). Setters raise `InvalidValueError` before any
23
+ I/O when a value is out of range, off its step, or not supported by the system
24
+ or zone. It subclasses both `ValueError` and `AttributeError`.
23
25
 
24
26
  ## Dependencies
25
27
 
@@ -37,6 +39,14 @@ The iZone Ethernet interface is documented in
37
39
  If Home Assistant can load the iZone integration, prefer **Download diagnostics**
38
40
  from the integration page.
39
41
 
42
+ A bridge is only reported as found once it answers over HTTP. When one replies
43
+ to discovery but fails that check, the library says why: `discover_all()`
44
+ lists it in the result's `unverified`, and `discover_by_host()` /
45
+ `discover_by_uid()` raise `EndpointVerifyError` with a `VerifyFailure` reason
46
+ (no HTTP reply, unreadable reply, a different UID, or a host name that didn't
47
+ resolve). Failures during background discovery are logged at debug level on
48
+ the `pizone.discovery` logger.
49
+
40
50
  When that is not possible (or you need a live HTTP/UDP survey of the bridge),
41
51
  run the stdlib probe from a machine on the same LAN:
42
52
 
@@ -70,5 +80,8 @@ Individual commands:
70
80
  To run integration tests against a controller on your network:
71
81
 
72
82
  ```bash
73
- uv run pytest tests/test_fullstack.py -m hardware -o addopts=
83
+ uv run pytest -m hardware -o addopts=
74
84
  ```
85
+
86
+ They bind UDP port 7005, so stop Home Assistant or anything else using iZone
87
+ discovery on the same machine first.
@@ -0,0 +1,23 @@
1
+ # Release notes — v1.3.12
2
+
3
+ **Compare range:** https://github.com/Swamp-Ig/pizone/compare/v1.3.11...v1.3.12
4
+
5
+ ## Since v1.3.11
6
+
7
+ ### V2 status data (new)
8
+
9
+ - Every V2 zone and system key now reaches the cache, so `dump_state()` and diagnostics include the full payload. Nested system groups (`UnitOpt`, `Temperzone`, `GasHeat`) are flattened to dotted keys such as `UnitOpt.RA`. The `LockCode` and `Pass` secrets are dropped and never cached
10
+ - New zone properties: `damper_position`, `damper_fault`, `sensor_fault`, `rf_signal`, `battery_level` and `sensor_type`, plus the `Zone.SensorType`, `Zone.RfSignal` and `Zone.BatteryLevel` enums. Each returns `None` when the bridge doesn't report it. `damper_fault` also works on V1
11
+ - `BattVolt` is decoded as the vendor's battery-level enum (full / half / empty), not volts
12
+ - Bridges without damper position feedback report a constant `DmpPos` of 50, so `damper_position` reads 50 on those units
13
+ - New controller properties: `airflow_lock`, `airflow_min_lock` and `system_locked`, which work on V1 and V2. V2 lock flags are normalized to the V1 `AirflowLock` / `UnitLocked` values
14
+ - New controller properties `indoor_humidity`, `indoor_tvoc` and `indoor_eco2`. These come from undocumented V2 keys (`InRh`, `InTVOC`, `IneCO2`), so their meaning and units are unverified
15
+
16
+ ### Fixes
17
+
18
+ - A missing `CtrlZone` no longer falls back to zone 0. `zone_ctrl` is now `int | None`, and `control_setpoint_owner` returns `None` when it is unknown
19
+ - `CtrlZone` 15 (unit setpoint, per the vendor header) now gives the unit ownership in every RAS mode, not only master
20
+
21
+ ### Maintenance
22
+
23
+ - Dependency lock bumps: aiohttp 3.14.4, multidict 6.9.1
@@ -0,0 +1,146 @@
1
+ # Release notes — v2.0.0
2
+
3
+ **Compare range:** https://github.com/Swamp-Ig/pizone/compare/v1.3.12...v2.0.0
4
+
5
+ This is a major release. It removes the legacy discovery and listener API
6
+ that has been deprecated since v1.3.5, and changes how discovery handles
7
+ hosts. If you only use `create_discovery()`, `create_controller()`, the
8
+ `discover_*` calls and the `refresh_*` methods, the changes you need to make
9
+ are small. See **Upgrading from 1.3.x**.
10
+
11
+ ## Since v1.3.12
12
+
13
+ ### Breaking: legacy API removed
14
+
15
+ These are gone. Use `create_discovery()` and `DiscoveryService.create_controller()`,
16
+ and drive refreshes yourself with `refresh_all()` and related methods.
17
+
18
+ - `pizone.discovery()` and `pizone.Listener`
19
+ - `DiscoveryService.add_listener()`, `remove_listener()`, `fetch_controller()`
20
+ and `fetch_controllers()`
21
+ - `Controller.refresh()`, `Controller.from_discovery()`, and the
22
+ `REFRESH_INTERVAL` and `UPDATE_REFRESH_DELAY` constants
23
+ - The library's own background poll, scan and reconnect loops
24
+
25
+ ### Breaking: discovery verifies hosts over HTTP
26
+
27
+ - `on_endpoint_discovered` fires only after the bridge answers an HTTP probe
28
+ with the expected UID. A UDP reply on its own no longer produces a
29
+ notification. Replies that fail the check are not notified, but each call
30
+ reports why (see **Breaking: why a bridge wasn't found**)
31
+ - A new address reported over UDP is also checked before it is used. A known
32
+ endpoint keeps its old address, and a running controller keeps its address
33
+ without firing `on_address_changed`, until the new address answers
34
+ - `discover_by_host()` no longer raises `ControllerAlreadyClaimedError`. Any
35
+ address that answers over HTTP is recorded like a verified UDP reply:
36
+ - a running controller with that UID is moved to it, and its
37
+ `on_address_changed` fires;
38
+ - a new or moved unclaimed endpoint triggers `on_endpoint_discovered`;
39
+ - a controller that is still being created is left alone.
40
+
41
+ This lets a host search or a reconfigure fix a controller whose bridge
42
+ moved while UDP was blocked
43
+ - `discover_by_uid()` no longer raises `ControllerAlreadyClaimedError` when a
44
+ create for the same UID starts during its scan. It still raises if the UID
45
+ is already claimed when the call starts
46
+
47
+ ### Breaking: why a bridge wasn't found
48
+
49
+ - `discover_by_host()` raises `EndpointVerifyError` instead of returning
50
+ `None` when the name doesn't resolve or no address answers with usable
51
+ settings
52
+ - `discover_by_uid()` raises `EndpointVerifyError` when the UID replied over
53
+ UDP but its address failed the check. It still returns `None` when the UID
54
+ never replied
55
+ - `EndpointVerifyError` is a `ConnectionError`, so catch it before broader
56
+ `OSError` handlers. Its `host`, `failure`, `uid` and `answered_uid`
57
+ attributes describe the failure. The message is plain English, meant for
58
+ logs; show users your own text built from the attributes
59
+ - New `VerifyFailure` reasons: `UNRESOLVED`, `NO_REPLY`, `UNREADABLE` and
60
+ `OTHER_UID`
61
+ - `discover_all()` now returns `DiscoveredEndpoints`, a list of the verified
62
+ endpoints as before, with an `unverified` attribute. It holds an
63
+ `UnverifiedEndpoint` (endpoint, failure, answered UID and time) for each
64
+ bridge that replied during that call but failed the check
65
+ - `create_controller()` raises `EndpointVerifyError`, still a
66
+ `ConnectionError`, when it can't reach the controller, so the reason is
67
+ available there too
68
+ - Failures during background discovery are logged at debug level on the
69
+ `pizone.discovery` logger
70
+
71
+ ### Host names
72
+
73
+ - `discover_by_host()` and `create_controller()` accept a host name as well
74
+ as an IPv4 address. The name is resolved to IPv4 addresses, which are
75
+ probed at the same time, and the first one that answers wins
76
+ - The library now tracks only UID to IP. Returned endpoints, controllers and
77
+ `on_address_changed` always use the IP, never the name. If you store a host
78
+ name in your configuration, keep it there rather than overwriting it from
79
+ `on_address_changed`
80
+
81
+ ### Controller creation
82
+
83
+ - `create_controller()` reserves the UID before its first network call. An
84
+ overlapping create for the same UID now raises
85
+ `ControllerAlreadyClaimedError` straight away instead of creating a second
86
+ controller. A failed create puts back the previously known address for that
87
+ UID, if there was one
88
+
89
+ ### Value validation
90
+
91
+ - New `InvalidValueError`, exported from `pizone`. Setters raise it before
92
+ sending anything when a value is out of range, off its step, or not
93
+ supported by the system or zone. It subclasses both `ValueError` and
94
+ `AttributeError`, so code that catches `AttributeError` keeps working
95
+
96
+ ### System faults
97
+
98
+ - Any system setting that reports `error`, plus a negative zone count, is now
99
+ reported as a fault. Only faults in `SysMode`, `RAS` or `NoOfZones` take the
100
+ controller offline (`connected` is `False`). Other faulted fields are
101
+ reported, but the settings are still used
102
+ - Behaviour changes: `SysMode` reporting `error` on its own now takes the
103
+ controller offline. `SysFan` reporting `error` on its own no longer does,
104
+ because it can be a fan mode the bridge can't name, and `fan` reads as
105
+ `AUTO` in that case
106
+ - Faults are logged once at `WARNING` level when the faulted fields appear or
107
+ change, then at `DEBUG` while they persist, and once at `INFO` when they
108
+ clear. Previously a warning was logged on every poll
109
+ - `Controller.dump_state()` has a new `last_fault` entry: the time, the
110
+ faulted fields, whether the controller went offline, and the settings the
111
+ bridge sent. It is kept after recovery, so intermittent faults still show
112
+ in diagnostics. It is `None` until a fault is seen
113
+
114
+ ### Fixes
115
+
116
+ - A V2 `SystemV2` reply that passes the usefulness check but can't be
117
+ converted now falls back to the V1 probe instead of raising
118
+
119
+ ### Diagnostics
120
+
121
+ - `DiscoveryService.dump_state()` gains `claiming` and `seen` lists alongside
122
+ `claimed` and `known`
123
+
124
+ ### Maintenance
125
+
126
+ - Ruff 0.17.3 and mypy 2.4.1, matching Home Assistant
127
+ - The V1 probe script is linted against Python 3.10, so reporters can still
128
+ run it on older Pythons
129
+ - New hardware tests for host handling and broader controller round trips.
130
+ Run them with `uv run pytest -m hardware -o addopts=`
131
+
132
+ ## Upgrading from 1.3.x
133
+
134
+ 1. Replace any use of `discovery()`, `Listener` or `fetch_controller()` with
135
+ `create_discovery()` and `create_controller()`, and call `refresh_all()`
136
+ on your own schedule.
137
+ 2. Remove handling of `ControllerAlreadyClaimedError` around
138
+ `discover_by_host()`. It is no longer raised there.
139
+ 3. `discover_by_host()` no longer returns `None` on failure. Catch
140
+ `EndpointVerifyError` from it, and from `discover_by_uid()`, before any
141
+ `OSError` or `ConnectionError` handler, and use its `failure` to tell the
142
+ user why.
143
+ 4. If you store a host name, don't overwrite it from `on_address_changed`.
144
+ The callback always reports an IP.
145
+ 5. Optionally catch `InvalidValueError` from setters to report invalid input
146
+ separately from device errors.
@@ -1,15 +1,16 @@
1
1
  """Interface to the iZone air conditioner controller.
2
2
 
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
3
+ Use :func:`~pizone.discovery.create_discovery` to obtain a discovery service,
4
+ then create :class:`~pizone.controller.Controller` instances through that
6
5
  service. Zones and power monitors are owned by their controller.
7
6
 
8
7
  Synchronous property reads return cached device data and do not raise
9
8
  :exc:`ConnectionError`. Async command and refresh methods perform HTTP I/O and
10
9
  raise :exc:`ConnectionError` when the device cannot be reached. They raise
11
10
  :exc:`~pizone.exceptions.ControllerCommandError` when the device responds but
12
- rejects the request (``{ERROR...}`` body or HTTP 4xx).
11
+ rejects the request (``{ERROR...}`` body or HTTP 4xx). Setters raise
12
+ :exc:`~pizone.exceptions.InvalidValueError` before any I/O when a value is out
13
+ of range, off its step, or not supported by the system or zone.
13
14
 
14
15
  Layered connection state on :class:`~pizone.controller.Controller`:
15
16
 
@@ -30,15 +31,22 @@ from typing import Any
30
31
 
31
32
  from . import power as power_mod
32
33
  from .controller import Controller
33
- from .discovery import DiscoveryService, Listener, create_discovery, discovery
34
+ from .discovery import DiscoveryService, create_discovery
34
35
  from .exceptions import (
35
36
  ControllerAlreadyClaimedError,
36
37
  ControllerCommandError,
38
+ EndpointVerifyError,
39
+ InvalidValueError,
37
40
  ResponseDecodeError,
38
41
  UnpairedBridgeError,
39
42
  )
40
43
  from .power import BatteryLevel, Power, PowerChannel, PowerDevice, PowerGroup
41
- from .types import ControllerEndpoint
44
+ from .types import (
45
+ ControllerEndpoint,
46
+ DiscoveredEndpoints,
47
+ UnverifiedEndpoint,
48
+ VerifyFailure,
49
+ )
42
50
  from .zone import Zone
43
51
 
44
52
 
@@ -69,15 +77,18 @@ __all__ = [
69
77
  "ControllerAlreadyClaimedError",
70
78
  "ControllerCommandError",
71
79
  "ControllerEndpoint",
80
+ "DiscoveredEndpoints",
72
81
  "DiscoveryService",
73
- "Listener",
82
+ "EndpointVerifyError",
83
+ "InvalidValueError",
74
84
  "Power",
75
85
  "PowerChannel",
76
86
  "PowerDevice",
77
87
  "PowerGroup",
78
88
  "ResponseDecodeError",
79
89
  "UnpairedBridgeError",
90
+ "UnverifiedEndpoint",
91
+ "VerifyFailure",
80
92
  "Zone",
81
93
  "create_discovery",
82
- "discovery",
83
94
  ]