Skip to content

Commit a2d272e

Browse files
committed
Keep live valve telemetry on fast polling
Keep battery, RSSI, and device metadata on the slower polling cadence while preserving fast updates for live thermostat valve telemetry.
1 parent bf2c337 commit a2d272e

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

custom_components/bosch/pointtapi_coordinator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
"/programs",
6767
"/system/appliance",
6868
)
69+
FAST_DEVICE_RESOURCE_MARKERS = (
70+
"/devices/list",
71+
"/etrv/",
72+
"/thermostat/",
73+
)
6974
# Re-run the discovery reference walk at most this often so resources that
7075
# appear later (e.g. solar enabled by an installer) get picked up.
7176
REDISCOVERY_INTERVAL = 24 * 3600
@@ -75,6 +80,10 @@
7580

7681
def _is_slow_resource(path: str) -> bool:
7782
"""Return whether a resource can use the slower polling cadence."""
83+
if path.startswith("/devices/") and any(
84+
marker in path for marker in FAST_DEVICE_RESOURCE_MARKERS
85+
):
86+
return False
7887
return path == "/notifications" or path.startswith(SLOW_RESOURCE_PREFIXES)
7988

8089

unittests/test_pointtapi_coordinator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,25 @@
1313
_fetch_paths,
1414
_fetch_history_hourly_all,
1515
_device_roots,
16+
_is_slow_resource,
1617
_program_roots,
1718
_zone_roots,
1819
BULK_WARN_INTERVAL,
1920
)
2021

2122

23+
def test_device_telemetry_uses_fast_polling_cadence():
24+
"""Valve readings must not inherit the slow inventory cadence."""
25+
assert not _is_slow_resource("/devices/device7/etrv/temperatureActual")
26+
assert not _is_slow_resource("/devices/device7/etrv/valvePosition")
27+
assert not _is_slow_resource("/devices/device7/etrv/childLock/enabled")
28+
assert not _is_slow_resource("/devices/list")
29+
assert _is_slow_resource("/devices/device7/battery")
30+
assert _is_slow_resource("/devices/device7/rssi")
31+
assert _is_slow_resource("/devices/device7/type")
32+
33+
34+
2235
# ── _fetch_paths ─────────────────────────────────────────────────────────────
2336

2437

0 commit comments

Comments
 (0)