Replace the breadth/silence downgrade heuristic with a simpler rule: a still-live OBSERVE session is never torn down on a sweep/cache mismatch (the 30s sweep already corrects the cache regardless of mode) -- only a proven reconnect invalidates subscriptions. A mismatch instead triggers extra hot/warm subpolls this cycle as a bounded fallback. Also stop treating a summary-poll block-level ACK timeout as session death: distinguish TimeoutError (transfer was progressing, session likely alive) from ConnectionError (session actually closed), backed by a consecutive-timeout counter so a genuinely dead channel still recovers. This was causing a flaky/slow device (e.g. a dishwasher) to flap observe<->poll every ~45s on nothing but a slow blockwise GET. Also remove the dead is_active/active_when scaffolding (never wired into the coordinator) and add DEBUG logging for each OBSERVE notify received, including its href.
27 lines
867 B
Python
27 lines
867 B
Python
import pytest
|
|
from tests.conftest import _load_device
|
|
from custom_components.localthings.registry.by_type import for_device, _type_key
|
|
from custom_components.localthings.registry.discovery import discover
|
|
from custom_components.localthings.registry.adapter import flatten
|
|
|
|
|
|
@pytest.mark.parametrize('name,expected_type_key', [
|
|
('dishwasher', 'dishwasher'),
|
|
('refrigerator', 'refrigerator'),
|
|
])
|
|
def test_full_pipeline_v2(name, expected_type_key):
|
|
resources = _load_device(name)
|
|
|
|
otn = resources.get('/otninformation/vs/0', {})
|
|
one_ui = otn.get('swVersionInfo', {}).get('oneUiVersion', '')
|
|
assert _type_key(one_ui) == expected_type_key
|
|
|
|
reg = for_device(one_ui)
|
|
assert reg is not None
|
|
|
|
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
|
assert bound
|
|
|
|
state = flatten(bound, resources)
|
|
assert state
|