From 30ebc6604f0e7bb6edfc71eea0026e81fc7a5e6e Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 20 Feb 2023 22:14:41 +0100 Subject: [PATCH] Invert trigger._PLATFORM_ALIASES (#88503) --- homeassistant/helpers/trigger.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/homeassistant/helpers/trigger.py b/homeassistant/helpers/trigger.py index 1e364878f03..52c5ab0e15e 100644 --- a/homeassistant/helpers/trigger.py +++ b/homeassistant/helpers/trigger.py @@ -37,8 +37,12 @@ if TYPE_CHECKING: ) _PLATFORM_ALIASES = { - "device_automation": ("device",), - "homeassistant": ("event", "numeric_state", "state", "time_pattern", "time"), + "device": "device_automation", + "event": "homeassistant", + "numeric_state": "homeassistant", + "state": "homeassistant", + "time_pattern": "homeassistant", + "time": "homeassistant", } DATA_PLUGGABLE_ACTIONS = "pluggable_actions" @@ -194,10 +198,7 @@ async def _async_get_trigger_platform( ) -> DeviceAutomationTriggerProtocol: platform_and_sub_type = config[CONF_PLATFORM].split(".") platform = platform_and_sub_type[0] - for alias, triggers in _PLATFORM_ALIASES.items(): - if platform in triggers: - platform = alias - break + platform = _PLATFORM_ALIASES.get(platform, platform) try: integration = await async_get_integration(hass, platform) except IntegrationNotFound: