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
This commit is contained in:
Marc Billow committed 2026-06-30 16:34:06 -05:00
1 parent 785154eb83
commit f7b58f00ee
34 files changed
+776 -1925

No files matched your search

+5 -9
View File
@@ -2,7 +2,7 @@ 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 build_runtime_descriptor
from samsung_appliance.registry.adapter import flatten, is_active
@pytest.mark.parametrize('name,expected_type_key', [
@@ -22,11 +22,7 @@ def test_full_pipeline_v2(name, expected_type_key):
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
assert bound
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
flat = rd.flatten(resources)
assert flat
assert rd.active_interval_s > 0
assert rd.idle_interval_s > rd.active_interval_s
state = flatten(bound, resources)
assert state
# is_active returns bool; just verify it runs without error
is_active(bound, resources)