Have homekit_controller use device registry (#23874)
* Add device registry support * HK doesn't use mac as a connection id
This commit is contained in:
parent
edf34eea94
commit
5b0d1415ad
6 changed files with 101 additions and 0 deletions
|
@ -39,3 +39,16 @@ async def test_aqara_gateway_setup(hass):
|
|||
assert light_state.attributes['supported_features'] == (
|
||||
SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||
)
|
||||
|
||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
||||
|
||||
# All the entities are services of the same accessory
|
||||
# So it looks at the protocol like a single physical device
|
||||
assert alarm.device_id == light.device_id
|
||||
|
||||
device = device_registry.async_get(light.device_id)
|
||||
assert device.manufacturer == 'Aqara'
|
||||
assert device.name == 'Aqara Hub-1563'
|
||||
assert device.model == 'ZHWA11LM'
|
||||
assert device.sw_version == '1.4.7'
|
||||
assert device.hub_device_id is None
|
||||
|
|
|
@ -67,6 +67,24 @@ async def test_ecobee3_setup(hass):
|
|||
occ3 = entity_registry.async_get('binary_sensor.basement')
|
||||
assert occ3.unique_id == 'homekit-AB3C-56'
|
||||
|
||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
||||
|
||||
climate_device = device_registry.async_get(climate.device_id)
|
||||
assert climate_device.manufacturer == 'ecobee Inc.'
|
||||
assert climate_device.name == 'HomeW'
|
||||
assert climate_device.model == 'ecobee3'
|
||||
assert climate_device.sw_version == '4.2.394'
|
||||
assert climate_device.hub_device_id is None
|
||||
|
||||
# Check that an attached sensor has its own device entity that
|
||||
# is linked to the bridge
|
||||
sensor_device = device_registry.async_get(occ1.device_id)
|
||||
assert sensor_device.manufacturer == 'ecobee Inc.'
|
||||
assert sensor_device.name == 'Kitchen'
|
||||
assert sensor_device.model == 'REMOTE SENSOR'
|
||||
assert sensor_device.sw_version == '1.0.0'
|
||||
assert sensor_device.hub_device_id == climate_device.id
|
||||
|
||||
|
||||
async def test_ecobee3_setup_from_cache(hass, hass_storage):
|
||||
"""Test that Ecbobee can be correctly setup from its cached entity map."""
|
||||
|
|
|
@ -38,6 +38,15 @@ async def test_koogeek_ls1_setup(hass):
|
|||
SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||
)
|
||||
|
||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
||||
|
||||
device = device_registry.async_get(entry.device_id)
|
||||
assert device.manufacturer == 'Koogeek'
|
||||
assert device.name == 'Koogeek-LS1-20833F'
|
||||
assert device.model == 'LS1'
|
||||
assert device.sw_version == '2.2.15'
|
||||
assert device.hub_device_id is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('failure_cls', [
|
||||
AccessoryDisconnectedError, EncryptionError
|
||||
|
|
|
@ -27,3 +27,15 @@ async def test_lennox_e30_setup(hass):
|
|||
assert climate_state.attributes['supported_features'] == (
|
||||
SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
|
||||
)
|
||||
|
||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
||||
|
||||
device = device_registry.async_get(climate.device_id)
|
||||
assert device.manufacturer == 'Lennox'
|
||||
assert device.name == 'Lennox'
|
||||
assert device.model == 'E30 2B'
|
||||
assert device.sw_version == '3.40.XX'
|
||||
|
||||
# The fixture contains a single accessory - so its a single device
|
||||
# and no bridge
|
||||
assert device.hub_device_id is None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue