File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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.
7176REDISCOVERY_INTERVAL = 24 * 3600
7580
7681def _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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments