mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 22:10:09 +00:00
Use TriggerActionType [core, d-h] (#76804)
This commit is contained in:
@@ -5,12 +5,9 @@ from typing import Any, Protocol, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.const import CONF_DOMAIN
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant
|
||||
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
@@ -40,8 +37,8 @@ class DeviceAutomationTriggerProtocol(Protocol):
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
action: AutomationActionType,
|
||||
automation_info: AutomationTriggerInfo,
|
||||
action: TriggerActionType,
|
||||
trigger_info: TriggerInfo,
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Attach a trigger."""
|
||||
|
||||
@@ -74,11 +71,11 @@ async def async_validate_trigger_config(
|
||||
async def async_attach_trigger(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
action: AutomationActionType,
|
||||
automation_info: AutomationTriggerInfo,
|
||||
action: TriggerActionType,
|
||||
trigger_info: TriggerInfo,
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Listen for trigger."""
|
||||
platform = await async_get_device_automation_platform(
|
||||
hass, config[CONF_DOMAIN], DeviceAutomationType.TRIGGER
|
||||
)
|
||||
return await platform.async_attach_trigger(hass, config, action, automation_info)
|
||||
return await platform.async_attach_trigger(hass, config, action, trigger_info)
|
||||
|
||||
Reference in New Issue
Block a user