Adjust device registry for Matter devices (#86108)
* adjust device registry * ignore test unique id * update test * ditch uniqueid + prefix serial * adjust test * add tests * fix switch test * prefix all identifiers * Update homeassistant/components/matter/adapter.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * no underscore in id * fix test Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
5e6ba594aa
commit
4bebf00598
7 changed files with 57 additions and 21 deletions
|
@ -28,10 +28,13 @@ async def test_device_registry_single_node_device(
|
|||
|
||||
dev_reg = dr.async_get(hass)
|
||||
entry = dev_reg.async_get_device(
|
||||
{(DOMAIN, "00000000000004D2-0000000000000001-MatterNodeDevice")}
|
||||
{(DOMAIN, "deviceid_00000000000004D2-0000000000000001-MatterNodeDevice")}
|
||||
)
|
||||
assert entry is not None
|
||||
|
||||
# test serial id present as additional identifier
|
||||
assert (DOMAIN, "serial_12345678") in entry.identifiers
|
||||
|
||||
assert entry.name == "Mock OnOff Light"
|
||||
assert entry.manufacturer == "Nabu Casa"
|
||||
assert entry.model == "Mock Light"
|
||||
|
@ -39,6 +42,30 @@ async def test_device_registry_single_node_device(
|
|||
assert entry.sw_version == "v1.0"
|
||||
|
||||
|
||||
async def test_device_registry_single_node_device_alt(
|
||||
hass: HomeAssistant,
|
||||
matter_client: MagicMock,
|
||||
) -> None:
|
||||
"""Test additional device with different attribute values."""
|
||||
await setup_integration_with_node_fixture(
|
||||
hass,
|
||||
"on-off-plugin-unit",
|
||||
matter_client,
|
||||
)
|
||||
|
||||
dev_reg = dr.async_get(hass)
|
||||
entry = dev_reg.async_get_device(
|
||||
{(DOMAIN, "deviceid_00000000000004D2-0000000000000001-MatterNodeDevice")}
|
||||
)
|
||||
assert entry is not None
|
||||
|
||||
# test name is derived from productName (because nodeLabel is absent)
|
||||
assert entry.name == "Mock OnOffPluginUnit (powerplug/switch)"
|
||||
|
||||
# test serial id NOT present as additional identifier
|
||||
assert (DOMAIN, "serial_TEST_SN") not in entry.identifiers
|
||||
|
||||
|
||||
@pytest.mark.skip("Waiting for a new test fixture")
|
||||
async def test_device_registry_bridge(
|
||||
hass: HomeAssistant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue