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:
1 parent
785154eb83
commit
f7b58f00ee
34 files changed
+776
-1925
No files matched your search
@@ -1,6 +1,5 @@
|
||||
"""Unit tests for oven-family capabilities and the cycle-active adapter wiring."""
|
||||
"""Unit tests for oven-family capabilities."""
|
||||
from samsung_appliance.registry.capabilities import oven
|
||||
from samsung_appliance.registry.adapter import build_runtime_descriptor
|
||||
from samsung_appliance.registry.discovery import discover
|
||||
|
||||
|
||||
@@ -151,36 +150,3 @@ def test_cook_time_rejects_out_of_range():
|
||||
assert desc.write_fn(-1, {}) is None
|
||||
assert desc.write_fn(1440, {}) is None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Adapter cycle_active_field wiring
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_adapter_sets_cycle_active_field_for_oven():
|
||||
"""build_runtime_descriptor must set cycle_active_field when oven keys present."""
|
||||
reg = {c.href: [c] for c in (oven.OVEN_OPERATIONAL_STATE, oven.OVEN_SETPOINT)}
|
||||
resources = {
|
||||
'/operational/state/vs/0': {'x.com.samsung.da.state': 'Run'},
|
||||
'/temperatures/vs/0': {'x.com.samsung.da.items': [
|
||||
{'x.com.samsung.da.current': '180', 'x.com.samsung.da.desired': '200'}
|
||||
]},
|
||||
}
|
||||
bound = discover(resources, reg)
|
||||
rd = build_runtime_descriptor(
|
||||
bound, topic_prefix='t', ha_prefix='homeassistant',
|
||||
device_name='Oven', model='M', name='oven', default_port=49154)
|
||||
assert rd.cycle_active_field == 'cycle_active'
|
||||
flat = rd.flatten(resources)
|
||||
assert flat['cycle_active'] is True # 'Run' -> active
|
||||
|
||||
|
||||
def test_adapter_no_cycle_active_without_oven_keys():
|
||||
"""Non-oven appliances must not get cycle_active_field."""
|
||||
from samsung_appliance.registry.capabilities import common
|
||||
reg = {c.href: [c] for c in (common.KIDS_LOCK,)}
|
||||
resources = {'/kidslock/vs/0': {'x.com.samsung.da.kidsLock': 'Ready'}}
|
||||
bound = discover(resources, reg)
|
||||
rd = build_runtime_descriptor(
|
||||
bound, topic_prefix='t', ha_prefix='homeassistant',
|
||||
device_name='Dishwasher', model='M', name='dishwasher', default_port=49154)
|
||||
assert rd.cycle_active_field is None
|
||||
Reference in new issue
Block a user