Use entity registry id in toggle_entity device automations (#94995)

* Use entity registry id in toggle_entity device automations

* Update tests

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Erik Montnemery 2023-06-26 09:59:01 +02:00 committed by GitHub
parent 408c613731
commit a338e7e242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1352 additions and 480 deletions

View file

@ -14,7 +14,7 @@ from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.zha import DOMAIN
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.setup import async_setup_component
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_TYPE
@ -164,6 +164,8 @@ async def test_get_inovelli_actions(hass: HomeAssistant, device_inovelli) -> Non
inovelli_reg_device = ha_device_registry.async_get_device(
{(DOMAIN, inovelli_ieee_address)}
)
ha_entity_registry = er.async_get(hass)
inovelli_light = ha_entity_registry.async_get("light.inovelli_vzm31_sn_light")
actions = await async_get_device_automations(
hass, DeviceAutomationType.ACTION, inovelli_reg_device.id
@ -192,21 +194,21 @@ async def test_get_inovelli_actions(hass: HomeAssistant, device_inovelli) -> Non
{
"device_id": inovelli_reg_device.id,
"domain": Platform.LIGHT,
"entity_id": "light.inovelli_vzm31_sn_light",
"entity_id": inovelli_light.id,
"metadata": {"secondary": False},
"type": "turn_off",
},
{
"device_id": inovelli_reg_device.id,
"domain": Platform.LIGHT,
"entity_id": "light.inovelli_vzm31_sn_light",
"entity_id": inovelli_light.id,
"metadata": {"secondary": False},
"type": "turn_on",
},
{
"device_id": inovelli_reg_device.id,
"domain": Platform.LIGHT,
"entity_id": "light.inovelli_vzm31_sn_light",
"entity_id": inovelli_light.id,
"metadata": {"secondary": False},
"type": "toggle",
},