python-duco-connectivity 0.18.0__tar.gz → 0.19.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 (26) hide show
  1. {python_duco_connectivity-0.18.0/src/python_duco_connectivity.egg-info → python_duco_connectivity-0.19.0}/PKG-INFO +4 -4
  2. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/README.md +3 -3
  3. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/pyproject.toml +1 -1
  4. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/client.py +12 -7
  5. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0/src/python_duco_connectivity.egg-info}/PKG-INFO +4 -4
  6. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_client.py +25 -0
  7. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/LICENSE +0 -0
  8. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/setup.cfg +0 -0
  9. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/__init__.py +0 -0
  10. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/__main__.py +0 -0
  11. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/cli.py +0 -0
  12. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/exceptions.py +0 -0
  13. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/models.py +0 -0
  14. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/duco_connectivity/py.typed +0 -0
  15. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/python_duco_connectivity.egg-info/SOURCES.txt +0 -0
  16. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/python_duco_connectivity.egg-info/dependency_links.txt +0 -0
  17. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/python_duco_connectivity.egg-info/entry_points.txt +0 -0
  18. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/python_duco_connectivity.egg-info/requires.txt +0 -0
  19. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/src/python_duco_connectivity.egg-info/top_level.txt +0 -0
  20. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_api_reference.py +0 -0
  21. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_cli.py +0 -0
  22. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_exceptions.py +0 -0
  23. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_local_sample_validation.py +0 -0
  24. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_models.py +0 -0
  25. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.0}/tests/test_pytest_live_support.py +0 -0
  26. {python_duco_connectivity-0.18.0 → python_duco_connectivity-0.19.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.18.0
3
+ Version: 0.19.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
@@ -73,9 +73,9 @@ in the development examples below.
73
73
  ## Error handling
74
74
 
75
75
  Discovery-style helpers use their natural empty result when a Duco box reports
76
- an optional capability as unsupported: filter time returns `None`, ventilation
77
- temperatures return an empty `VentilationTemperatureInfo`, and bulk bypass
78
- targets return `{}`. Malformed responses and operational failures remain
76
+ an optional capability as unsupported: filter time and the write budget return
77
+ `None`, ventilation temperatures return an empty `VentilationTemperatureInfo`,
78
+ and bulk bypass targets return `{}`. Malformed responses and operational failures remain
79
79
  exceptions. The strict parameter-specific bypass helper raises
80
80
  `DucoUnsupportedCapabilityError` for an unsupported target; this
81
81
  `DucoResponseError` subclass preserves the HTTP status, path, and response body.
@@ -41,9 +41,9 @@ in the development examples below.
41
41
  ## Error handling
42
42
 
43
43
  Discovery-style helpers use their natural empty result when a Duco box reports
44
- an optional capability as unsupported: filter time returns `None`, ventilation
45
- temperatures return an empty `VentilationTemperatureInfo`, and bulk bypass
46
- targets return `{}`. Malformed responses and operational failures remain
44
+ an optional capability as unsupported: filter time and the write budget return
45
+ `None`, ventilation temperatures return an empty `VentilationTemperatureInfo`,
46
+ and bulk bypass targets return `{}`. Malformed responses and operational failures remain
47
47
  exceptions. The strict parameter-specific bypass helper raises
48
48
  `DucoUnsupportedCapabilityError` for an unsupported target; this
49
49
  `DucoResponseError` subclass preserves the HTTP status, path, and response body.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-duco-connectivity"
7
- version = "0.18.0"
7
+ version = "0.19.0"
8
8
  description = "Async HTTP client for the local Duco Connectivity API"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -2298,12 +2298,17 @@ class DucoClient:
2298
2298
 
2299
2299
  return self._parse_node(payload)
2300
2300
 
2301
- async def async_get_write_requests_remaining(self) -> int:
2302
- """Return the remaining write budget reported by the box."""
2303
- payload = await self.async_get_info(
2304
- module="General",
2305
- submodule="PublicApi",
2306
- )
2301
+ async def async_get_write_requests_remaining(self) -> int | None:
2302
+ """Return the remaining write budget, or None if the box does not support it."""
2303
+ try:
2304
+ payload = await self.async_get_info(
2305
+ module="General",
2306
+ submodule="PublicApi",
2307
+ )
2308
+ except DucoResponseError as err:
2309
+ if _is_unsupported_optional_endpoint_error(err, "/info"):
2310
+ return None
2311
+ raise
2307
2312
  return int(self._read_wrapped_value(payload["General"]["PublicApi"], "WriteReqCntRemain"))
2308
2313
 
2309
2314
  async def async_get_time_filter_remaining(self) -> int | None:
@@ -2470,7 +2475,7 @@ class DucoClient:
2470
2475
  raise DucoError(msg)
2471
2476
  return updated_target
2472
2477
 
2473
- async def async_get_write_req_remaining(self) -> int:
2478
+ async def async_get_write_req_remaining(self) -> int | None:
2474
2479
  """Backward-compatible alias for the old write budget method name."""
2475
2480
  caller = _compat_caller()
2476
2481
  if caller is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-duco-connectivity
3
- Version: 0.18.0
3
+ Version: 0.19.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
@@ -73,9 +73,9 @@ in the development examples below.
73
73
  ## Error handling
74
74
 
75
75
  Discovery-style helpers use their natural empty result when a Duco box reports
76
- an optional capability as unsupported: filter time returns `None`, ventilation
77
- temperatures return an empty `VentilationTemperatureInfo`, and bulk bypass
78
- targets return `{}`. Malformed responses and operational failures remain
76
+ an optional capability as unsupported: filter time and the write budget return
77
+ `None`, ventilation temperatures return an empty `VentilationTemperatureInfo`,
78
+ and bulk bypass targets return `{}`. Malformed responses and operational failures remain
79
79
  exceptions. The strict parameter-specific bypass helper raises
80
80
  `DucoUnsupportedCapabilityError` for an unsupported target; this
81
81
  `DucoResponseError` subclass preserves the HTTP status, path, and response body.
@@ -4294,6 +4294,31 @@ async def test_get_write_requests_remaining_is_parsed() -> None:
4294
4294
  assert remaining == 197
4295
4295
 
4296
4296
 
4297
+ async def test_get_write_requests_remaining_returns_none_when_unsupported() -> None:
4298
+ """An unsupported write budget should not be reported as exhausted."""
4299
+ mock_response = _response(status=400, text_payload='{"Code":3,"Result":"FAILED"}')
4300
+
4301
+ async with aiohttp.ClientSession() as session:
4302
+ client = DucoClient(session=session, host="192.0.2.94")
4303
+ with patch.object(session, "request", _request(mock_response)):
4304
+ assert await client.async_get_write_requests_remaining() is None
4305
+
4306
+
4307
+ async def test_get_write_requests_remaining_reraises_other_bad_requests() -> None:
4308
+ """A different bad request response is not an unsupported write budget."""
4309
+ mock_response = _response(status=400, text_payload='{"Code":4,"Result":"FAILED"}')
4310
+
4311
+ async with aiohttp.ClientSession() as session:
4312
+ client = DucoClient(session=session, host="192.0.2.94")
4313
+ with (
4314
+ patch.object(session, "request", _request(mock_response)),
4315
+ pytest.raises(DucoResponseError) as err,
4316
+ ):
4317
+ await client.async_get_write_requests_remaining()
4318
+
4319
+ assert err.value.status == 400
4320
+
4321
+
4297
4322
  async def test_get_time_filter_remaining_is_parsed() -> None:
4298
4323
  """Heat recovery filter time should be parsed when the box reports it."""
4299
4324
  payload: dict[str, object] = {"HeatRecovery": {"General": {"TimeFilterRemain": {"Val": 180}}}}