Teach device_tracker device trigger about entity registry ids (#94972)

This commit is contained in:
Erik Montnemery 2023-06-21 14:51:00 +02:00 committed by GitHub
parent 49c7d2ff89
commit 20be441c9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 123 additions and 19 deletions

View file

@ -27,7 +27,7 @@ TRIGGER_TYPES: Final[set[str]] = {"enters", "leaves"}
TRIGGER_SCHEMA: Final = DEVICE_TRIGGER_BASE_SCHEMA.extend(
{
vol.Required(CONF_ENTITY_ID): cv.entity_id,
vol.Required(CONF_ENTITY_ID): cv.entity_id_or_uuid,
vol.Required(CONF_TYPE): vol.In(TRIGGER_TYPES),
vol.Required(CONF_ZONE): cv.entity_domain(DOMAIN_ZONE),
}
@ -51,7 +51,7 @@ async def async_get_triggers(
CONF_PLATFORM: "device",
CONF_DEVICE_ID: device_id,
CONF_DOMAIN: DOMAIN,
CONF_ENTITY_ID: entry.entity_id,
CONF_ENTITY_ID: entry.id,
CONF_TYPE: "enters",
}
)
@ -60,7 +60,7 @@ async def async_get_triggers(
CONF_PLATFORM: "device",
CONF_DEVICE_ID: device_id,
CONF_DOMAIN: DOMAIN,
CONF_ENTITY_ID: entry.entity_id,
CONF_ENTITY_ID: entry.id,
CONF_TYPE: "leaves",
}
)