Files
localthings/tests/test_air_purifier_avt_ww.py
T
Marc Billow 74f34b91a5 feat(registry): route AVT-WW-TP1-23 air purifier boards (#190)
AVT-WW-TP1-23-AXX500 (AX053B810HGD) reported device_type 'unknown' with
empty oneUiVersion, falling back to common caps. It's the same BESPOKE
Cube Air lineage as A-VTWW-TP2-21-COMMON (issue #151), just with the
'-WW-' delimiter shifted one letter left ('A-VTWW-' -> 'AVT-WW-'), which
splits into an 'AVT'/'WW' token pair the existing whole-token 'VTWW' entry
can't see. Added 'AVT' as its own board token onto the same air_purifier
registry -- the resource surface (wind/strength fan, HEPA filter, air
quality sensors, alarms) already matched with zero unbound hrefs once
routed there, so no new capabilities were needed.
2026-07-29 13:06:36 +00:00

63 lines
2.4 KiB
Python

"""Tests for the AVT-WW-TP1-23-AXX500 air-purifier profile (issue #190).
Next-gen BESPOKE Cube Air board -- same resource surface as the
A-VTWW-TP2-21-COMMON family (issue #151), but the '-WW-' delimiter now falls
one letter to the left ('A-VTWW-' -> 'AVT-WW-'), splitting into an 'AVT'/'WW'
token pair the existing 'VTWW' whole-token entry can't see. The reporter's
diagnostics showed device_type 'unknown' with empty oneUiVersion and every
resource unbound -- once routed to the existing air_purifier registry, every
resource here binds with zero gaps.
"""
from custom_components.localthings.registry.adapter import flatten
from custom_components.localthings.registry.by_type import for_device_by_model
from custom_components.localthings.registry.discovery import discover
from tests.conftest import _load_device
def _resources():
return _load_device('air_purifier_avt_ww')
def _reg(resources):
info = resources['/information/vs/0']
return for_device_by_model(
info['x.com.samsung.da.modelNum'], info['x.com.samsung.da.description'])
def test_resolves_to_air_purifier_registry():
assert _reg(_resources()).name == 'air_purifier'
def test_no_unbound_hrefs():
resources = _resources()
reg = _reg(resources)
unbound = []
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
assert unbound == []
def test_wind_strength_fan_preset_names():
"""This dump's /wind/strength/vs/0 reports the same numeric-code +
modesName shape as the original VTWW fixture (SMART/MAX/WINDFREE/Sleep),
confirming the shared WIND_STRENGTH_FAN capability applies unchanged."""
resources = _resources()
reg = _reg(resources)
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
state = flatten(bound, resources)
assert state['wind_strength_fan'] == '87'
wind = resources['/wind/strength/vs/0']
assert wind['x.com.samsung.da.modesName'] == ['SMART', 'MAX', 'WINDFREE', 'Sleep']
def test_air_quality_and_filter_sensors_present():
resources = _resources()
reg = _reg(resources)
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
state = flatten(bound, resources)
assert state['dust'] == 10
assert state['fine_dust'] == 9
assert state['odor'] == 1
assert state['hepa_filter_usage'] == 0
assert state['hepa_filter_status'] == 'normal'