mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Invert trigger._PLATFORM_ALIASES (#88503)
This commit is contained in:
parent
35adb2f7e8
commit
30ebc6604f
@ -37,8 +37,12 @@ if TYPE_CHECKING:
|
|||||||
)
|
)
|
||||||
|
|
||||||
_PLATFORM_ALIASES = {
|
_PLATFORM_ALIASES = {
|
||||||
"device_automation": ("device",),
|
"device": "device_automation",
|
||||||
"homeassistant": ("event", "numeric_state", "state", "time_pattern", "time"),
|
"event": "homeassistant",
|
||||||
|
"numeric_state": "homeassistant",
|
||||||
|
"state": "homeassistant",
|
||||||
|
"time_pattern": "homeassistant",
|
||||||
|
"time": "homeassistant",
|
||||||
}
|
}
|
||||||
|
|
||||||
DATA_PLUGGABLE_ACTIONS = "pluggable_actions"
|
DATA_PLUGGABLE_ACTIONS = "pluggable_actions"
|
||||||
@ -194,10 +198,7 @@ async def _async_get_trigger_platform(
|
|||||||
) -> DeviceAutomationTriggerProtocol:
|
) -> DeviceAutomationTriggerProtocol:
|
||||||
platform_and_sub_type = config[CONF_PLATFORM].split(".")
|
platform_and_sub_type = config[CONF_PLATFORM].split(".")
|
||||||
platform = platform_and_sub_type[0]
|
platform = platform_and_sub_type[0]
|
||||||
for alias, triggers in _PLATFORM_ALIASES.items():
|
platform = _PLATFORM_ALIASES.get(platform, platform)
|
||||||
if platform in triggers:
|
|
||||||
platform = alias
|
|
||||||
break
|
|
||||||
try:
|
try:
|
||||||
integration = await async_get_integration(hass, platform)
|
integration = await async_get_integration(hass, platform)
|
||||||
except IntegrationNotFound:
|
except IntegrationNotFound:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user