python-duco-connectivity 0.14.0__tar.gz → 0.16.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_duco_connectivity-0.14.0/src/python_duco_connectivity.egg-info → python_duco_connectivity-0.16.0}/PKG-INFO +14 -3
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/README.md +13 -2
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/pyproject.toml +1 -1
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/__init__.py +2 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/cli.py +3 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/client.py +91 -36
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/models.py +12 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0/src/python_duco_connectivity.egg-info}/PKG-INFO +14 -3
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_client.py +141 -50
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/LICENSE +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/setup.cfg +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/__main__.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/exceptions.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/py.typed +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/python_duco_connectivity.egg-info/SOURCES.txt +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/python_duco_connectivity.egg-info/dependency_links.txt +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/python_duco_connectivity.egg-info/entry_points.txt +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/python_duco_connectivity.egg-info/requires.txt +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/python_duco_connectivity.egg-info/top_level.txt +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_api_reference.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_cli.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_exceptions.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_local_sample_validation.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_models.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_pytest_live_support.py +0 -0
- {python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_replay_helpers.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-duco-connectivity
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: Async HTTP client for the local Duco Connectivity API
|
|
5
5
|
Author: Ronald van der Meer
|
|
6
6
|
License-Expression: MIT
|
|
@@ -64,6 +64,7 @@ in the development examples below.
|
|
|
64
64
|
- asynchronous communication via `aiohttp`
|
|
65
65
|
- typed stable config families for the documented `/config` branches
|
|
66
66
|
- typed helpers for stable `/info` fields such as heat recovery filter time
|
|
67
|
+
- a typed overview for selected values from one unfiltered `/info` request
|
|
67
68
|
- natural empty results for optional capability discovery and explicit errors
|
|
68
69
|
for strict capability access
|
|
69
70
|
- typed models that stay close to the API response shape
|
|
@@ -86,8 +87,7 @@ or inconsistent. `BypassSupplyTemperatureTarget.validate_value()` checks a
|
|
|
86
87
|
Celsius value against the target-specific range and step, while
|
|
87
88
|
`normalize_value()` rounds converted values to the nearest supported step. Pass
|
|
88
89
|
the target to `async_set_bypass_supply_temperature_target(..., target=target)`
|
|
89
|
-
to validate a write without an additional read.
|
|
90
|
-
the legacy finite and exact-decicelsius validation temporarily.
|
|
90
|
+
to validate a write without an additional read.
|
|
91
91
|
|
|
92
92
|
Diagnostic subsystem reads expose known status values as normalized `DiagStatus`
|
|
93
93
|
members (`ok`, `disabled`, or `error`). Each `DiagComponent` also keeps the exact
|
|
@@ -98,6 +98,13 @@ pre-0.13 raw status string remains compatible and derives `raw_status`
|
|
|
98
98
|
automatically; callers using a normalized `DiagStatus` must provide
|
|
99
99
|
`raw_status` explicitly.
|
|
100
100
|
|
|
101
|
+
`async_get_info_overview()` combines RSSI, diagnostic subsystems, heat recovery
|
|
102
|
+
filter time, and ventilation temperatures from one `GET /info` request. Missing
|
|
103
|
+
product-specific modules produce their natural empty values. Unlike most typed
|
|
104
|
+
models, `InfoOverview` does not retain the broad response or the LAN raw
|
|
105
|
+
payload, because that response can contain network credentials such as the
|
|
106
|
+
Wi-Fi access point key.
|
|
107
|
+
|
|
101
108
|
## Getting started
|
|
102
109
|
|
|
103
110
|
```python
|
|
@@ -112,9 +119,11 @@ async def main() -> None:
|
|
|
112
119
|
async with aiohttp.ClientSession() as session:
|
|
113
120
|
client = DucoClient(session, "192.168.1.10")
|
|
114
121
|
api_info = await client.async_get_api_info()
|
|
122
|
+
info = await client.async_get_info_overview()
|
|
115
123
|
nodes = await client.async_get_nodes_overview()
|
|
116
124
|
|
|
117
125
|
print(api_info.public_api_version)
|
|
126
|
+
print(info.rssi_wifi)
|
|
118
127
|
print([node.node_id for node in nodes])
|
|
119
128
|
|
|
120
129
|
|
|
@@ -130,6 +139,8 @@ public client methods, exports, compatibility aliases, and construction rules.
|
|
|
130
139
|
- `docs/api-reference.md` for the central public API inventory
|
|
131
140
|
- `docs/cli.md` for the function probe CLI and shell examples
|
|
132
141
|
- `docs/config.md` for system, node, and zone config reads and writes
|
|
142
|
+
- `docs/endpoint-inventory.md` for the Public API 2.5 read routes and observed
|
|
143
|
+
response shapes across tested Duco products
|
|
133
144
|
- `docs/live-testing.md` for local opt-in tests against a real Duco device
|
|
134
145
|
- `docs/replay-testing.md` for local sample validation against ignored raw API
|
|
135
146
|
captures
|
|
@@ -32,6 +32,7 @@ in the development examples below.
|
|
|
32
32
|
- asynchronous communication via `aiohttp`
|
|
33
33
|
- typed stable config families for the documented `/config` branches
|
|
34
34
|
- typed helpers for stable `/info` fields such as heat recovery filter time
|
|
35
|
+
- a typed overview for selected values from one unfiltered `/info` request
|
|
35
36
|
- natural empty results for optional capability discovery and explicit errors
|
|
36
37
|
for strict capability access
|
|
37
38
|
- typed models that stay close to the API response shape
|
|
@@ -54,8 +55,7 @@ or inconsistent. `BypassSupplyTemperatureTarget.validate_value()` checks a
|
|
|
54
55
|
Celsius value against the target-specific range and step, while
|
|
55
56
|
`normalize_value()` rounds converted values to the nearest supported step. Pass
|
|
56
57
|
the target to `async_set_bypass_supply_temperature_target(..., target=target)`
|
|
57
|
-
to validate a write without an additional read.
|
|
58
|
-
the legacy finite and exact-decicelsius validation temporarily.
|
|
58
|
+
to validate a write without an additional read.
|
|
59
59
|
|
|
60
60
|
Diagnostic subsystem reads expose known status values as normalized `DiagStatus`
|
|
61
61
|
members (`ok`, `disabled`, or `error`). Each `DiagComponent` also keeps the exact
|
|
@@ -66,6 +66,13 @@ pre-0.13 raw status string remains compatible and derives `raw_status`
|
|
|
66
66
|
automatically; callers using a normalized `DiagStatus` must provide
|
|
67
67
|
`raw_status` explicitly.
|
|
68
68
|
|
|
69
|
+
`async_get_info_overview()` combines RSSI, diagnostic subsystems, heat recovery
|
|
70
|
+
filter time, and ventilation temperatures from one `GET /info` request. Missing
|
|
71
|
+
product-specific modules produce their natural empty values. Unlike most typed
|
|
72
|
+
models, `InfoOverview` does not retain the broad response or the LAN raw
|
|
73
|
+
payload, because that response can contain network credentials such as the
|
|
74
|
+
Wi-Fi access point key.
|
|
75
|
+
|
|
69
76
|
## Getting started
|
|
70
77
|
|
|
71
78
|
```python
|
|
@@ -80,9 +87,11 @@ async def main() -> None:
|
|
|
80
87
|
async with aiohttp.ClientSession() as session:
|
|
81
88
|
client = DucoClient(session, "192.168.1.10")
|
|
82
89
|
api_info = await client.async_get_api_info()
|
|
90
|
+
info = await client.async_get_info_overview()
|
|
83
91
|
nodes = await client.async_get_nodes_overview()
|
|
84
92
|
|
|
85
93
|
print(api_info.public_api_version)
|
|
94
|
+
print(info.rssi_wifi)
|
|
86
95
|
print([node.node_id for node in nodes])
|
|
87
96
|
|
|
88
97
|
|
|
@@ -98,6 +107,8 @@ public client methods, exports, compatibility aliases, and construction rules.
|
|
|
98
107
|
- `docs/api-reference.md` for the central public API inventory
|
|
99
108
|
- `docs/cli.md` for the function probe CLI and shell examples
|
|
100
109
|
- `docs/config.md` for system, node, and zone config reads and writes
|
|
110
|
+
- `docs/endpoint-inventory.md` for the Public API 2.5 read routes and observed
|
|
111
|
+
response shapes across tested Duco products
|
|
101
112
|
- `docs/live-testing.md` for local opt-in tests against a real Duco device
|
|
102
113
|
- `docs/replay-testing.md` for local sample validation against ignored raw API
|
|
103
114
|
captures
|
|
@@ -62,6 +62,7 @@ from .models import (
|
|
|
62
62
|
InfoGroup,
|
|
63
63
|
InfoGroupStruct,
|
|
64
64
|
InfoModuleSelector,
|
|
65
|
+
InfoOverview,
|
|
65
66
|
InfoZone,
|
|
66
67
|
InfoZoneGroup,
|
|
67
68
|
InfoZonesOverview,
|
|
@@ -183,6 +184,7 @@ __all__ = [
|
|
|
183
184
|
"InfoGroup",
|
|
184
185
|
"InfoGroupStruct",
|
|
185
186
|
"InfoModuleSelector",
|
|
187
|
+
"InfoOverview",
|
|
186
188
|
"InfoZone",
|
|
187
189
|
"InfoZoneGroup",
|
|
188
190
|
"InfoZoneStruct",
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/cli.py
RENAMED
|
@@ -76,6 +76,9 @@ METHOD_SPECS: dict[str, MethodSpec] = {
|
|
|
76
76
|
description="Return the typed response from /config/zones/{zone}.",
|
|
77
77
|
),
|
|
78
78
|
"async_get_board_info": MethodSpec(description="Return board identity details."),
|
|
79
|
+
"async_get_info_overview": MethodSpec(
|
|
80
|
+
description="Return selected typed values from one unfiltered /info request."
|
|
81
|
+
),
|
|
79
82
|
"async_get_lan_info": MethodSpec(description="Return LAN settings."),
|
|
80
83
|
"async_get_diagnostics_info": MethodSpec(
|
|
81
84
|
description="Return the typed diagnostics response from /info?module=Diag."
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/client.py
RENAMED
|
@@ -63,6 +63,7 @@ from .models import (
|
|
|
63
63
|
InfoGroup,
|
|
64
64
|
InfoGroupStruct,
|
|
65
65
|
InfoModuleSelector,
|
|
66
|
+
InfoOverview,
|
|
66
67
|
InfoZone,
|
|
67
68
|
InfoZoneGroup,
|
|
68
69
|
InfoZonesOverview,
|
|
@@ -2052,6 +2053,50 @@ class DucoClient:
|
|
|
2052
2053
|
raw_payload=self._preserve_raw_payload(board),
|
|
2053
2054
|
)
|
|
2054
2055
|
|
|
2056
|
+
@classmethod
|
|
2057
|
+
def _parse_info_overview(cls, payload: Any) -> InfoOverview:
|
|
2058
|
+
"""Parse selected values from an unfiltered `/info` payload."""
|
|
2059
|
+
if not isinstance(payload, dict):
|
|
2060
|
+
msg = f"Expected object payload from /info, got {type(payload).__name__}"
|
|
2061
|
+
raise DucoError(msg)
|
|
2062
|
+
|
|
2063
|
+
rssi_wifi = None
|
|
2064
|
+
general = payload.get("General")
|
|
2065
|
+
if general is not None:
|
|
2066
|
+
if not isinstance(general, dict):
|
|
2067
|
+
msg = (
|
|
2068
|
+
"Expected object payload at General in /info response, got "
|
|
2069
|
+
f"{type(general).__name__}"
|
|
2070
|
+
)
|
|
2071
|
+
raise DucoError(msg)
|
|
2072
|
+
lan = general.get("Lan")
|
|
2073
|
+
if lan is not None:
|
|
2074
|
+
if not isinstance(lan, dict):
|
|
2075
|
+
msg = (
|
|
2076
|
+
"Expected object payload at General.Lan in /info response, got "
|
|
2077
|
+
f"{type(lan).__name__}"
|
|
2078
|
+
)
|
|
2079
|
+
raise DucoError(msg)
|
|
2080
|
+
rssi_wifi = cls._read_optional_wrapped_int(
|
|
2081
|
+
lan,
|
|
2082
|
+
"RssiWifi",
|
|
2083
|
+
path="General.Lan",
|
|
2084
|
+
)
|
|
2085
|
+
|
|
2086
|
+
return InfoOverview(
|
|
2087
|
+
rssi_wifi=rssi_wifi,
|
|
2088
|
+
diagnostic_subsystems=cls._parse_diag_info(payload).diagnostic_subsystems,
|
|
2089
|
+
time_filter_remain=cls._parse_time_filter_remaining(payload, request_context="/info"),
|
|
2090
|
+
ventilation_temperatures=cls._parse_ventilation_temperature_info(
|
|
2091
|
+
payload, request_context="/info"
|
|
2092
|
+
),
|
|
2093
|
+
)
|
|
2094
|
+
|
|
2095
|
+
async def async_get_info_overview(self) -> InfoOverview:
|
|
2096
|
+
"""Return selected typed values from one unfiltered `/info` request."""
|
|
2097
|
+
payload = await self._request_json("GET", "/info")
|
|
2098
|
+
return self._parse_info_overview(payload)
|
|
2099
|
+
|
|
2055
2100
|
async def async_get_lan_info(self) -> LanInfo:
|
|
2056
2101
|
"""Return LAN settings reported by the box."""
|
|
2057
2102
|
payload = await self.async_get_info(
|
|
@@ -2258,31 +2303,36 @@ class DucoClient:
|
|
|
2258
2303
|
return None
|
|
2259
2304
|
raise
|
|
2260
2305
|
|
|
2306
|
+
return self._parse_time_filter_remaining(payload)
|
|
2307
|
+
|
|
2308
|
+
@classmethod
|
|
2309
|
+
def _parse_time_filter_remaining(
|
|
2310
|
+
cls,
|
|
2311
|
+
payload: Any,
|
|
2312
|
+
*,
|
|
2313
|
+
request_context: str = "/info?module=HeatRecovery",
|
|
2314
|
+
) -> int | None:
|
|
2315
|
+
"""Parse remaining heat recovery filter time from an info payload."""
|
|
2316
|
+
|
|
2261
2317
|
if not isinstance(payload, dict):
|
|
2262
|
-
msg = (
|
|
2263
|
-
"Expected object payload from /info?module=HeatRecovery, got "
|
|
2264
|
-
f"{type(payload).__name__}"
|
|
2265
|
-
)
|
|
2318
|
+
msg = f"Expected object payload from {request_context}, got {type(payload).__name__}"
|
|
2266
2319
|
raise DucoError(msg)
|
|
2267
2320
|
|
|
2268
2321
|
heat_recovery = payload.get("HeatRecovery")
|
|
2269
2322
|
if heat_recovery is None:
|
|
2270
2323
|
return None
|
|
2271
2324
|
if not isinstance(heat_recovery, dict):
|
|
2272
|
-
msg = "Expected object payload at HeatRecovery in
|
|
2325
|
+
msg = f"Expected object payload at HeatRecovery in {request_context} response"
|
|
2273
2326
|
raise DucoError(msg)
|
|
2274
2327
|
|
|
2275
2328
|
general = heat_recovery.get("General")
|
|
2276
2329
|
if general is None:
|
|
2277
2330
|
return None
|
|
2278
2331
|
if not isinstance(general, dict):
|
|
2279
|
-
msg =
|
|
2280
|
-
"Expected object payload at HeatRecovery.General in "
|
|
2281
|
-
"/info?module=HeatRecovery response"
|
|
2282
|
-
)
|
|
2332
|
+
msg = f"Expected object payload at HeatRecovery.General in {request_context} response"
|
|
2283
2333
|
raise DucoError(msg)
|
|
2284
2334
|
|
|
2285
|
-
return
|
|
2335
|
+
return cls._read_optional_wrapped_int(
|
|
2286
2336
|
general,
|
|
2287
2337
|
"TimeFilterRemain",
|
|
2288
2338
|
path="HeatRecovery.General",
|
|
@@ -2297,40 +2347,46 @@ class DucoClient:
|
|
|
2297
2347
|
return VentilationTemperatureInfo()
|
|
2298
2348
|
raise
|
|
2299
2349
|
|
|
2350
|
+
return self._parse_ventilation_temperature_info(payload)
|
|
2351
|
+
|
|
2352
|
+
@classmethod
|
|
2353
|
+
def _parse_ventilation_temperature_info(
|
|
2354
|
+
cls,
|
|
2355
|
+
payload: Any,
|
|
2356
|
+
*,
|
|
2357
|
+
request_context: str = "/info?module=Ventilation",
|
|
2358
|
+
) -> VentilationTemperatureInfo:
|
|
2359
|
+
"""Parse ventilation temperatures from an info payload."""
|
|
2360
|
+
|
|
2300
2361
|
if not isinstance(payload, dict):
|
|
2301
|
-
msg = (
|
|
2302
|
-
"Expected object payload from /info?module=Ventilation, got "
|
|
2303
|
-
f"{type(payload).__name__}"
|
|
2304
|
-
)
|
|
2362
|
+
msg = f"Expected object payload from {request_context}, got {type(payload).__name__}"
|
|
2305
2363
|
raise DucoError(msg)
|
|
2306
2364
|
|
|
2307
2365
|
ventilation = payload.get("Ventilation")
|
|
2308
2366
|
if ventilation is None:
|
|
2309
2367
|
return VentilationTemperatureInfo()
|
|
2310
2368
|
if not isinstance(ventilation, dict):
|
|
2311
|
-
msg = "Expected object payload at Ventilation in
|
|
2369
|
+
msg = f"Expected object payload at Ventilation in {request_context} response"
|
|
2312
2370
|
raise DucoError(msg)
|
|
2313
2371
|
|
|
2314
2372
|
sensor = ventilation.get("Sensor")
|
|
2315
2373
|
if sensor is None:
|
|
2316
|
-
return VentilationTemperatureInfo(raw_payload=
|
|
2374
|
+
return VentilationTemperatureInfo(raw_payload=cls._preserve_raw_payload(ventilation))
|
|
2317
2375
|
if not isinstance(sensor, dict):
|
|
2318
|
-
msg =
|
|
2319
|
-
"Expected object payload at Ventilation.Sensor in /info?module=Ventilation response"
|
|
2320
|
-
)
|
|
2376
|
+
msg = f"Expected object payload at Ventilation.Sensor in {request_context} response"
|
|
2321
2377
|
raise DucoError(msg)
|
|
2322
2378
|
|
|
2323
|
-
temp_oda =
|
|
2324
|
-
temp_sup =
|
|
2325
|
-
temp_eta =
|
|
2326
|
-
temp_eha =
|
|
2379
|
+
temp_oda = cls._read_optional_wrapped_int(sensor, "TempOda", path="Ventilation.Sensor")
|
|
2380
|
+
temp_sup = cls._read_optional_wrapped_int(sensor, "TempSup", path="Ventilation.Sensor")
|
|
2381
|
+
temp_eta = cls._read_optional_wrapped_int(sensor, "TempEta", path="Ventilation.Sensor")
|
|
2382
|
+
temp_eha = cls._read_optional_wrapped_int(sensor, "TempEha", path="Ventilation.Sensor")
|
|
2327
2383
|
|
|
2328
2384
|
return VentilationTemperatureInfo(
|
|
2329
|
-
temp_oda=None if temp_oda is None else
|
|
2330
|
-
temp_sup=None if temp_sup is None else
|
|
2331
|
-
temp_eta=None if temp_eta is None else
|
|
2332
|
-
temp_eha=None if temp_eha is None else
|
|
2333
|
-
raw_payload=
|
|
2385
|
+
temp_oda=None if temp_oda is None else cls._decicelsius_to_celsius(temp_oda),
|
|
2386
|
+
temp_sup=None if temp_sup is None else cls._decicelsius_to_celsius(temp_sup),
|
|
2387
|
+
temp_eta=None if temp_eta is None else cls._decicelsius_to_celsius(temp_eta),
|
|
2388
|
+
temp_eha=None if temp_eha is None else cls._decicelsius_to_celsius(temp_eha),
|
|
2389
|
+
raw_payload=cls._preserve_raw_payload(sensor),
|
|
2334
2390
|
)
|
|
2335
2391
|
|
|
2336
2392
|
async def async_get_bypass_supply_temperature_target(
|
|
@@ -2379,14 +2435,13 @@ class DucoClient:
|
|
|
2379
2435
|
zone_id: int,
|
|
2380
2436
|
temperature: float,
|
|
2381
2437
|
*,
|
|
2382
|
-
target: BypassSupplyTemperatureTarget
|
|
2438
|
+
target: BypassSupplyTemperatureTarget,
|
|
2383
2439
|
) -> BypassSupplyTemperatureTarget:
|
|
2384
2440
|
"""Set a bypass supply target through `/config` using Celsius input."""
|
|
2385
2441
|
parameter = self._validate_bypass_zone_id(zone_id)
|
|
2386
|
-
if target
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
target.validate_value(temperature)
|
|
2442
|
+
if target.zone_id != zone_id:
|
|
2443
|
+
raise ValueError("target zone_id must match zone_id")
|
|
2444
|
+
target.validate_value(temperature)
|
|
2390
2445
|
raw_value = self._celsius_to_decicelsius(
|
|
2391
2446
|
temperature,
|
|
2392
2447
|
path=f"bypass_supply_temperature_target[{zone_id}]",
|
|
@@ -2397,11 +2452,11 @@ class DucoClient:
|
|
|
2397
2452
|
submodule=ConfigHeatRecoverySubmoduleSelector.BYPASS,
|
|
2398
2453
|
parameter=parameter,
|
|
2399
2454
|
)
|
|
2400
|
-
|
|
2401
|
-
if
|
|
2455
|
+
updated_target = self._extract_bypass_supply_temperature_target(response, zone_id)
|
|
2456
|
+
if updated_target is None:
|
|
2402
2457
|
msg = f"Expected {parameter} in /config response after bypass target write"
|
|
2403
2458
|
raise DucoError(msg)
|
|
2404
|
-
return
|
|
2459
|
+
return updated_target
|
|
2405
2460
|
|
|
2406
2461
|
async def async_get_write_req_remaining(self) -> int:
|
|
2407
2462
|
"""Backward-compatible alias for the old write budget method name."""
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/models.py
RENAMED
|
@@ -1676,6 +1676,18 @@ class DiagInfo:
|
|
|
1676
1676
|
raw_payload: dict[str, Any] = field(default_factory=dict, repr=False, compare=False)
|
|
1677
1677
|
|
|
1678
1678
|
|
|
1679
|
+
@dataclass(frozen=True, slots=True)
|
|
1680
|
+
class InfoOverview:
|
|
1681
|
+
"""Selected typed values returned by an unfiltered `/info` request."""
|
|
1682
|
+
|
|
1683
|
+
rssi_wifi: int | None = None
|
|
1684
|
+
diagnostic_subsystems: tuple[DiagComponent, ...] = ()
|
|
1685
|
+
time_filter_remain: int | None = None
|
|
1686
|
+
ventilation_temperatures: VentilationTemperatureInfo = field(
|
|
1687
|
+
default_factory=VentilationTemperatureInfo
|
|
1688
|
+
)
|
|
1689
|
+
|
|
1690
|
+
|
|
1679
1691
|
@dataclass(frozen=True, slots=True, init=False)
|
|
1680
1692
|
class Action:
|
|
1681
1693
|
"""System action request payload."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-duco-connectivity
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: Async HTTP client for the local Duco Connectivity API
|
|
5
5
|
Author: Ronald van der Meer
|
|
6
6
|
License-Expression: MIT
|
|
@@ -64,6 +64,7 @@ in the development examples below.
|
|
|
64
64
|
- asynchronous communication via `aiohttp`
|
|
65
65
|
- typed stable config families for the documented `/config` branches
|
|
66
66
|
- typed helpers for stable `/info` fields such as heat recovery filter time
|
|
67
|
+
- a typed overview for selected values from one unfiltered `/info` request
|
|
67
68
|
- natural empty results for optional capability discovery and explicit errors
|
|
68
69
|
for strict capability access
|
|
69
70
|
- typed models that stay close to the API response shape
|
|
@@ -86,8 +87,7 @@ or inconsistent. `BypassSupplyTemperatureTarget.validate_value()` checks a
|
|
|
86
87
|
Celsius value against the target-specific range and step, while
|
|
87
88
|
`normalize_value()` rounds converted values to the nearest supported step. Pass
|
|
88
89
|
the target to `async_set_bypass_supply_temperature_target(..., target=target)`
|
|
89
|
-
to validate a write without an additional read.
|
|
90
|
-
the legacy finite and exact-decicelsius validation temporarily.
|
|
90
|
+
to validate a write without an additional read.
|
|
91
91
|
|
|
92
92
|
Diagnostic subsystem reads expose known status values as normalized `DiagStatus`
|
|
93
93
|
members (`ok`, `disabled`, or `error`). Each `DiagComponent` also keeps the exact
|
|
@@ -98,6 +98,13 @@ pre-0.13 raw status string remains compatible and derives `raw_status`
|
|
|
98
98
|
automatically; callers using a normalized `DiagStatus` must provide
|
|
99
99
|
`raw_status` explicitly.
|
|
100
100
|
|
|
101
|
+
`async_get_info_overview()` combines RSSI, diagnostic subsystems, heat recovery
|
|
102
|
+
filter time, and ventilation temperatures from one `GET /info` request. Missing
|
|
103
|
+
product-specific modules produce their natural empty values. Unlike most typed
|
|
104
|
+
models, `InfoOverview` does not retain the broad response or the LAN raw
|
|
105
|
+
payload, because that response can contain network credentials such as the
|
|
106
|
+
Wi-Fi access point key.
|
|
107
|
+
|
|
101
108
|
## Getting started
|
|
102
109
|
|
|
103
110
|
```python
|
|
@@ -112,9 +119,11 @@ async def main() -> None:
|
|
|
112
119
|
async with aiohttp.ClientSession() as session:
|
|
113
120
|
client = DucoClient(session, "192.168.1.10")
|
|
114
121
|
api_info = await client.async_get_api_info()
|
|
122
|
+
info = await client.async_get_info_overview()
|
|
115
123
|
nodes = await client.async_get_nodes_overview()
|
|
116
124
|
|
|
117
125
|
print(api_info.public_api_version)
|
|
126
|
+
print(info.rssi_wifi)
|
|
118
127
|
print([node.node_id for node in nodes])
|
|
119
128
|
|
|
120
129
|
|
|
@@ -130,6 +139,8 @@ public client methods, exports, compatibility aliases, and construction rules.
|
|
|
130
139
|
- `docs/api-reference.md` for the central public API inventory
|
|
131
140
|
- `docs/cli.md` for the function probe CLI and shell examples
|
|
132
141
|
- `docs/config.md` for system, node, and zone config reads and writes
|
|
142
|
+
- `docs/endpoint-inventory.md` for the Public API 2.5 read routes and observed
|
|
143
|
+
response shapes across tested Duco products
|
|
133
144
|
- `docs/live-testing.md` for local opt-in tests against a real Duco device
|
|
134
145
|
- `docs/replay-testing.md` for local sample validation against ignored raw API
|
|
135
146
|
captures
|
|
@@ -55,6 +55,7 @@ from duco_connectivity import (
|
|
|
55
55
|
InfoGeneralSubmoduleSelector,
|
|
56
56
|
InfoGroup,
|
|
57
57
|
InfoModuleSelector,
|
|
58
|
+
InfoOverview,
|
|
58
59
|
InfoZone,
|
|
59
60
|
InfoZoneGroup,
|
|
60
61
|
InfoZonesOverview,
|
|
@@ -2004,6 +2005,127 @@ async def test_lan_info_wifi_is_parsed(lan_info_data: dict[str, object]) -> None
|
|
|
2004
2005
|
assert lan.raw_payload is lan_info_data["General"]["Lan"]
|
|
2005
2006
|
|
|
2006
2007
|
|
|
2008
|
+
async def test_info_overview_parses_supported_data_without_sensitive_raw_payload(
|
|
2009
|
+
generic_info_all_data: dict[str, object],
|
|
2010
|
+
) -> None:
|
|
2011
|
+
"""The broad info overview should expose only its typed public contract."""
|
|
2012
|
+
mock_response = _response(json_payload=generic_info_all_data)
|
|
2013
|
+
|
|
2014
|
+
async with aiohttp.ClientSession() as session:
|
|
2015
|
+
client = DucoClient(session=session, host="192.0.2.94")
|
|
2016
|
+
with patch.object(session, "request", _request(mock_response)) as request_mock:
|
|
2017
|
+
overview = await client.async_get_info_overview()
|
|
2018
|
+
|
|
2019
|
+
assert isinstance(overview, InfoOverview)
|
|
2020
|
+
assert_type(overview, InfoOverview)
|
|
2021
|
+
assert overview.rssi_wifi == -47
|
|
2022
|
+
assert tuple(subsystem.component for subsystem in overview.diagnostic_subsystems) == (
|
|
2023
|
+
"Ventilation",
|
|
2024
|
+
"VentCool",
|
|
2025
|
+
"SunCtrl",
|
|
2026
|
+
)
|
|
2027
|
+
assert overview.time_filter_remain is None
|
|
2028
|
+
assert overview.ventilation_temperatures == VentilationTemperatureInfo()
|
|
2029
|
+
assert not hasattr(overview, "raw_payload")
|
|
2030
|
+
assert request_mock.call_args.args == ("GET", "http://192.0.2.94/info")
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
async def test_info_overview_parses_energy_modules() -> None:
|
|
2034
|
+
"""The broad info overview should combine all supported ENERGY data."""
|
|
2035
|
+
payload: dict[str, object] = {
|
|
2036
|
+
"General": {
|
|
2037
|
+
"Lan": {
|
|
2038
|
+
"WifiApKey": {"Val": "secret"},
|
|
2039
|
+
"RssiWifi": {"Val": -51},
|
|
2040
|
+
}
|
|
2041
|
+
},
|
|
2042
|
+
"Diag": {
|
|
2043
|
+
"SubSystems": [
|
|
2044
|
+
{"Component": "Ventilation", "Status": "Ok"},
|
|
2045
|
+
]
|
|
2046
|
+
},
|
|
2047
|
+
"HeatRecovery": {
|
|
2048
|
+
"General": {"TimeFilterRemain": {"Val": 7200}},
|
|
2049
|
+
},
|
|
2050
|
+
"Ventilation": {
|
|
2051
|
+
"Sensor": {
|
|
2052
|
+
"TempOda": {"Val": 175},
|
|
2053
|
+
"TempSup": {"Val": 180},
|
|
2054
|
+
"TempEta": {"Val": 215},
|
|
2055
|
+
"TempEha": {"Val": 225},
|
|
2056
|
+
}
|
|
2057
|
+
},
|
|
2058
|
+
}
|
|
2059
|
+
mock_response = _response(json_payload=payload)
|
|
2060
|
+
|
|
2061
|
+
async with aiohttp.ClientSession() as session:
|
|
2062
|
+
client = DucoClient(session=session, host="192.0.2.94")
|
|
2063
|
+
with patch.object(session, "request", _request(mock_response)):
|
|
2064
|
+
overview = await client.async_get_info_overview()
|
|
2065
|
+
|
|
2066
|
+
assert overview.rssi_wifi == -51
|
|
2067
|
+
assert overview.diagnostic_subsystems[0].status is DiagStatus.OK
|
|
2068
|
+
assert overview.time_filter_remain == 7200
|
|
2069
|
+
assert overview.ventilation_temperatures == VentilationTemperatureInfo(
|
|
2070
|
+
temp_oda=17.5,
|
|
2071
|
+
temp_sup=18.0,
|
|
2072
|
+
temp_eta=21.5,
|
|
2073
|
+
temp_eha=22.5,
|
|
2074
|
+
)
|
|
2075
|
+
assert "WifiApKey" not in repr(overview)
|
|
2076
|
+
|
|
2077
|
+
|
|
2078
|
+
@pytest.mark.parametrize(
|
|
2079
|
+
("payload", "message"),
|
|
2080
|
+
[
|
|
2081
|
+
pytest.param(
|
|
2082
|
+
[],
|
|
2083
|
+
"Expected object payload from /info, got list",
|
|
2084
|
+
id="top-level",
|
|
2085
|
+
),
|
|
2086
|
+
pytest.param(
|
|
2087
|
+
{"General": []},
|
|
2088
|
+
"Expected object payload at General in /info response, got list",
|
|
2089
|
+
id="general",
|
|
2090
|
+
),
|
|
2091
|
+
pytest.param(
|
|
2092
|
+
{"General": {"Lan": []}},
|
|
2093
|
+
"Expected object payload at General.Lan in /info response, got list",
|
|
2094
|
+
id="lan",
|
|
2095
|
+
),
|
|
2096
|
+
pytest.param(
|
|
2097
|
+
{"General": {"Lan": {"RssiWifi": {"Val": "strong"}}}},
|
|
2098
|
+
"Expected integer value for General.Lan.RssiWifi, got str",
|
|
2099
|
+
id="rssi",
|
|
2100
|
+
),
|
|
2101
|
+
pytest.param(
|
|
2102
|
+
{"HeatRecovery": []},
|
|
2103
|
+
"Expected object payload at HeatRecovery in /info response",
|
|
2104
|
+
id="heat-recovery",
|
|
2105
|
+
),
|
|
2106
|
+
pytest.param(
|
|
2107
|
+
{"Ventilation": []},
|
|
2108
|
+
"Expected object payload at Ventilation in /info response",
|
|
2109
|
+
id="ventilation",
|
|
2110
|
+
),
|
|
2111
|
+
],
|
|
2112
|
+
)
|
|
2113
|
+
async def test_info_overview_rejects_malformed_payloads(
|
|
2114
|
+
payload: object,
|
|
2115
|
+
message: str,
|
|
2116
|
+
) -> None:
|
|
2117
|
+
"""Present malformed overview sections should fail with field context."""
|
|
2118
|
+
mock_response = _response(json_payload=payload)
|
|
2119
|
+
|
|
2120
|
+
async with aiohttp.ClientSession() as session:
|
|
2121
|
+
client = DucoClient(session=session, host="192.0.2.94")
|
|
2122
|
+
with (
|
|
2123
|
+
patch.object(session, "request", _request(mock_response)),
|
|
2124
|
+
pytest.raises(DucoError, match=re.escape(message)),
|
|
2125
|
+
):
|
|
2126
|
+
await client.async_get_info_overview()
|
|
2127
|
+
|
|
2128
|
+
|
|
2007
2129
|
async def test_lan_info_ethernet_is_parsed(
|
|
2008
2130
|
lan_info_ethernet_data: dict[str, object],
|
|
2009
2131
|
) -> None:
|
|
@@ -4042,37 +4164,13 @@ async def test_bypass_supply_temperature_helpers_reject_invalid_zone_ids(zone_id
|
|
|
4042
4164
|
with pytest.raises(ValueError, match="zone_id must be an integer between 1 and 8"):
|
|
4043
4165
|
await client.async_get_bypass_supply_temperature_target(cast(Any, zone_id))
|
|
4044
4166
|
|
|
4167
|
+
dummy_target = BypassSupplyTemperatureTarget(
|
|
4168
|
+
zone_id=1, value=18.0, minimum=12.0, increment=0.5, maximum=22.0
|
|
4169
|
+
)
|
|
4045
4170
|
with pytest.raises(ValueError, match="zone_id must be an integer between 1 and 8"):
|
|
4046
|
-
await client.async_set_bypass_supply_temperature_target(
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
async def test_set_bypass_supply_temperature_target_serializes_decicelsius(
|
|
4050
|
-
config_data: dict[str, object],
|
|
4051
|
-
) -> None:
|
|
4052
|
-
"""Bypass target helpers should serialize Celsius writes as raw decicelsius values."""
|
|
4053
|
-
mock_response = _response(json_payload=config_data)
|
|
4054
|
-
|
|
4055
|
-
async with aiohttp.ClientSession() as session:
|
|
4056
|
-
client = DucoClient(session=session, host="192.0.2.94")
|
|
4057
|
-
request = MagicMock(return_value=_request_context(mock_response))
|
|
4058
|
-
with patch.object(session, "request", request):
|
|
4059
|
-
payload = await client.async_set_bypass_supply_temperature_target(2, 18.5)
|
|
4060
|
-
|
|
4061
|
-
assert payload == BypassSupplyTemperatureTarget(
|
|
4062
|
-
zone_id=2,
|
|
4063
|
-
value=18.5,
|
|
4064
|
-
minimum=12.0,
|
|
4065
|
-
increment=0.5,
|
|
4066
|
-
maximum=22.0,
|
|
4067
|
-
)
|
|
4068
|
-
_, kwargs = request.call_args
|
|
4069
|
-
assert kwargs["params"] == {
|
|
4070
|
-
"module": "HeatRecovery",
|
|
4071
|
-
"submodule": "Bypass",
|
|
4072
|
-
"parameter": "TempSupTgtZone2",
|
|
4073
|
-
}
|
|
4074
|
-
assert kwargs["data"] == b'{"HeatRecovery":{"Bypass":{"TempSupTgtZone2":{"Val":185}}}}'
|
|
4075
|
-
assert kwargs["headers"] == {"Content-Type": "application/json"}
|
|
4171
|
+
await client.async_set_bypass_supply_temperature_target(
|
|
4172
|
+
cast(Any, zone_id), 18.0, target=dummy_target
|
|
4173
|
+
)
|
|
4076
4174
|
|
|
4077
4175
|
|
|
4078
4176
|
async def test_set_bypass_supply_temperature_target_validates_against_target(
|
|
@@ -4160,30 +4258,23 @@ async def test_set_bypass_supply_temperature_target_rejects_invalid_response() -
|
|
|
4160
4258
|
|
|
4161
4259
|
async with aiohttp.ClientSession() as session:
|
|
4162
4260
|
client = DucoClient(session=session, host="192.0.2.94")
|
|
4261
|
+
valid_target = BypassSupplyTemperatureTarget(
|
|
4262
|
+
zone_id=1, value=18.0, minimum=12.0, increment=0.5, maximum=22.0
|
|
4263
|
+
)
|
|
4264
|
+
mock_request = _request(mock_response)
|
|
4163
4265
|
with (
|
|
4164
|
-
patch.object(session, "request",
|
|
4266
|
+
patch.object(session, "request", mock_request),
|
|
4165
4267
|
pytest.raises(DucoError, match="Invalid TempSupTgtZone1: missing Max"),
|
|
4166
4268
|
):
|
|
4167
|
-
await client.async_set_bypass_supply_temperature_target(1, 18.0)
|
|
4168
|
-
|
|
4269
|
+
await client.async_set_bypass_supply_temperature_target(1, 18.0, target=valid_target)
|
|
4169
4270
|
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
]
|
|
4177
|
-
)
|
|
4178
|
-
async def test_set_bypass_supply_temperature_target_rejects_invalid_temperatures(
|
|
4179
|
-
value: object,
|
|
4180
|
-
message: str,
|
|
4181
|
-
) -> None:
|
|
4182
|
-
"""Invalid convenience write values should fail before a request is sent."""
|
|
4183
|
-
async with aiohttp.ClientSession() as session:
|
|
4184
|
-
client = DucoClient(session=session, host="192.0.2.94")
|
|
4185
|
-
with pytest.raises(ValueError, match=re.escape(message)):
|
|
4186
|
-
await client.async_set_bypass_supply_temperature_target(1, cast(Any, value))
|
|
4271
|
+
_, kwargs = mock_request.call_args
|
|
4272
|
+
assert kwargs["params"] == {
|
|
4273
|
+
"module": "HeatRecovery",
|
|
4274
|
+
"submodule": "Bypass",
|
|
4275
|
+
"parameter": "TempSupTgtZone1",
|
|
4276
|
+
}
|
|
4277
|
+
assert kwargs["data"] == b'{"HeatRecovery":{"Bypass":{"TempSupTgtZone1":{"Val":180}}}}'
|
|
4187
4278
|
|
|
4188
4279
|
|
|
4189
4280
|
async def test_get_write_requests_remaining_is_parsed() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/src/duco_connectivity/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_api_reference.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.14.0 → python_duco_connectivity-0.16.0}/tests/test_replay_helpers.py
RENAMED
|
File without changes
|