Teach button device trigger about entity registry ids (#94965)
* Teach button device trigger about entity registry ids * Update homekit_controller tests
This commit is contained in:
parent
4414f06ed2
commit
49ec806046
3 changed files with 81 additions and 26 deletions
|
@ -91,16 +91,17 @@ async def test_enumerate_remote(hass: HomeAssistant, utcnow) -> None:
|
|||
await setup_test_component(hass, create_remote)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||
bat_sensor = entity_registry.async_get("sensor.testdevice_battery")
|
||||
identify_button = entity_registry.async_get("button.testdevice_identify")
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
device = device_registry.async_get(entry.device_id)
|
||||
device = device_registry.async_get(bat_sensor.device_id)
|
||||
|
||||
expected = [
|
||||
{
|
||||
"device_id": device.id,
|
||||
"domain": "sensor",
|
||||
"entity_id": "sensor.testdevice_battery",
|
||||
"entity_id": bat_sensor.entity_id,
|
||||
"platform": "device",
|
||||
"type": "battery_level",
|
||||
"metadata": {"secondary": True},
|
||||
|
@ -108,7 +109,7 @@ async def test_enumerate_remote(hass: HomeAssistant, utcnow) -> None:
|
|||
{
|
||||
"device_id": device.id,
|
||||
"domain": "button",
|
||||
"entity_id": "button.testdevice_identify",
|
||||
"entity_id": identify_button.id,
|
||||
"platform": "device",
|
||||
"type": "pressed",
|
||||
"metadata": {"secondary": True},
|
||||
|
@ -139,16 +140,17 @@ async def test_enumerate_button(hass: HomeAssistant, utcnow) -> None:
|
|||
await setup_test_component(hass, create_button)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||
bat_sensor = entity_registry.async_get("sensor.testdevice_battery")
|
||||
identify_button = entity_registry.async_get("button.testdevice_identify")
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
device = device_registry.async_get(entry.device_id)
|
||||
device = device_registry.async_get(bat_sensor.device_id)
|
||||
|
||||
expected = [
|
||||
{
|
||||
"device_id": device.id,
|
||||
"domain": "sensor",
|
||||
"entity_id": "sensor.testdevice_battery",
|
||||
"entity_id": bat_sensor.entity_id,
|
||||
"platform": "device",
|
||||
"type": "battery_level",
|
||||
"metadata": {"secondary": True},
|
||||
|
@ -156,7 +158,7 @@ async def test_enumerate_button(hass: HomeAssistant, utcnow) -> None:
|
|||
{
|
||||
"device_id": device.id,
|
||||
"domain": "button",
|
||||
"entity_id": "button.testdevice_identify",
|
||||
"entity_id": identify_button.id,
|
||||
"platform": "device",
|
||||
"type": "pressed",
|
||||
"metadata": {"secondary": True},
|
||||
|
@ -186,16 +188,17 @@ async def test_enumerate_doorbell(hass: HomeAssistant, utcnow) -> None:
|
|||
await setup_test_component(hass, create_doorbell)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
entry = entity_registry.async_get("sensor.testdevice_battery")
|
||||
bat_sensor = entity_registry.async_get("sensor.testdevice_battery")
|
||||
identify_button = entity_registry.async_get("button.testdevice_identify")
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
device = device_registry.async_get(entry.device_id)
|
||||
device = device_registry.async_get(bat_sensor.device_id)
|
||||
|
||||
expected = [
|
||||
{
|
||||
"device_id": device.id,
|
||||
"domain": "sensor",
|
||||
"entity_id": "sensor.testdevice_battery",
|
||||
"entity_id": bat_sensor.entity_id,
|
||||
"platform": "device",
|
||||
"type": "battery_level",
|
||||
"metadata": {"secondary": True},
|
||||
|
@ -203,7 +206,7 @@ async def test_enumerate_doorbell(hass: HomeAssistant, utcnow) -> None:
|
|||
{
|
||||
"device_id": device.id,
|
||||
"domain": "button",
|
||||
"entity_id": "button.testdevice_identify",
|
||||
"entity_id": identify_button.id,
|
||||
"platform": "device",
|
||||
"type": "pressed",
|
||||
"metadata": {"secondary": True},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue