Files
localthings/tests/test_end_to_end_v2.py
T
Marc Billow f7b58f00ee feat: replace MQTT bridge with localthings HA custom component
Convert from MQTT bridge architecture to a proper Home Assistant
integration (custom_components/localthings/):

- Config flow: IP-only entry, probes ports [49154,49155], cert/key
  reused from first device on subsequent adds
- Coordinator: DataUpdateCoordinator wrapping blocking DTLS session
  via async_add_executor_job; discovery on first poll; dynamic 5s/30s
  interval based on active_when
- Entity platforms: sensor, binary_sensor, switch, number, select
- Library cleanup: delete bridge.py, main.py, config.py, logger.py,
  keepalive.py, poll_scheduler.py, sensors.py, state_cache.py
- adapter.py stripped to flatten(), is_active(), _key()
- _parse_device0_batch moved to samsung_appliance/batch.py
2026-06-30 16:34:06 -05:00

29 lines
938 B
Python

import pytest
from tests.conftest import _load_device
from samsung_appliance.registry.by_type import for_device, _type_key
from samsung_appliance.registry.discovery import discover
from samsung_appliance.registry.adapter import flatten, is_active
@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
# is_active returns bool; just verify it runs without error
is_active(bound, resources)