refactor: rewire bridge to batch-poll /device/0 + per-type registry

Replace PollScheduler + OBSERVE with:
- _parse_device0_batch() extracts {href: rep} from /device/0 list response
- _discover_and_publish() uses by_type.for_device(oneUiVersion) for
  device-specific capability registry; falls back to global CAPABILITIES
- _poll_loop thread: batch GET /device/0 at active_interval_s or
  idle_interval_s; applies each rep to the state cache
- All OBSERVE machinery removed (subscribe, notifications, fetchback)
This commit is contained in:
Marc Billow committed 2026-06-30 16:33:36 -05:00
1 parent 15f462563d
commit 2b22673210
2 files changed
+98 -271

No files matched your search

+4 -4
View File
@@ -10,16 +10,16 @@ from samsung_appliance.registry import (CAPABILITIES, discover,
('dishwasher', '10.0.0.129'),
('refrigerator', '10.0.0.254'),
])
def test_full_pipeline_produces_entities_and_observe_paths(name, ip):
def test_full_pipeline_produces_entities_and_intervals(name, ip):
resources = json.load(open(f'local-tools/dumps/{ip}.json'))['resources']
bound = discover(resources, CAPABILITIES)
rd = build_runtime_descriptor(
bound, topic_prefix=f'samsung_{name}', ha_prefix='homeassistant',
device_name=name.title(), model='M', name=name, default_port=49154)
assert rd.discovery_payloads, "no entities discovered"
assert rd.observe_paths, "no observe paths"
assert any(t.name == 'hot' for t in rd.poll_tiers), "no hot tier"
assert any(t.is_sweep for t in rd.poll_tiers), "no sweep tier"
assert rd.active_interval_s > 0, "active_interval_s must be positive"
assert rd.idle_interval_s > rd.active_interval_s, (
"idle_interval_s must be greater than active_interval_s")
# flatten runs cleanly over the real rep set
flat = rd.flatten(resources)
assert flat