perf(common): poll power state on the warm tier (#56)

/power/0 and /power/vs/0 had no poll_tier, so they only ever refreshed on
the once-per-30s summary poll -- everything else that drives real-time
switch/climate/fan state (e.g. remote-control enablement) is already on
the faster subscribe/subpoll 'warm' cadence for exactly this reason. Scoped
to just this one tier bump; the model-specific priority-flip claim in the
same issue thread isn't independently verified, so it isn't part of this
change.
This commit is contained in:
Marc Billow
2026-07-29 13:33:26 +00:00
parent 36240b44e6
commit a003650d31
2 changed files with 15 additions and 0 deletions
@@ -259,6 +259,12 @@ def sensor_item_value(items, sensor_type, index=0):
POWER_GENERIC = Capability(
href='/power/0',
# Neither href of this pair carried a poll_tier before (issue #56's
# follow-up), so power state only ever refreshed on the once-per-30s
# summary poll instead of the subscribe/subpoll cadence 'warm' and 'hot'
# hrefs get -- the same "signal drives real-time state, but sat in the
# slow default tier" gap as REMOTE_CONTROL_GENERIC/VS_FALLBACK above.
poll_tier='warm',
entities=(
# Writable when firmware allows remote power; otherwise a read-only
# binary_sensor with the same key keeps HA state without a dead switch.
@@ -277,6 +283,7 @@ POWER_GENERIC = Capability(
POWER_VS_FALLBACK = Capability(
href='/power/vs/0',
match_fn=lambda rep, resources: '/power/0' not in resources,
poll_tier='warm',
entities=(
SwitchDesc(key='power_switch', field='x.com.samsung.da.power',
value_fn=lambda v: v == 'On',
+8
View File
@@ -152,6 +152,14 @@ class TestPowerFallback:
assert switch.exists_fn(resources['/power/0'], resources) is True
assert sensor.exists_fn(resources['/power/0'], resources) is False
def test_polled_warm_so_power_state_reflects_quickly(self):
"""issue #56 follow-up: neither href had a poll_tier, so power state
only ever refreshed on the once-per-30s summary poll instead of the
subscribe/subpoll cadence 'warm'/'hot' hrefs get -- same reasoning
as REMOTE_CONTROL_GENERIC/VS_FALLBACK's own 'warm' tier."""
assert common.POWER_GENERIC.poll_tier == 'warm'
assert common.POWER_VS_FALLBACK.poll_tier == 'warm'
class TestWmSetinfoFlags:
def test_washer_fixture_carries_setinfo_from_device0(self):