Automation trigger info type hint improvements (#55402)
* Make automation trigger info a TypedDict * zwave_js trigger type hint fixes * Remove redundant automation trigger info field presence checks * Use async_initialize_triggers in mqtt and tasmota device_trigger tests
This commit is contained in:
parent
0749e045bb
commit
b10fc89a6b
46 changed files with 344 additions and 210 deletions
|
@ -7,7 +7,10 @@ from typing import Any, Callable
|
|||
import attr
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.automation import AutomationActionType
|
||||
from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
|
@ -86,7 +89,7 @@ class TriggerInstance:
|
|||
"""Attached trigger settings."""
|
||||
|
||||
action: AutomationActionType = attr.ib()
|
||||
automation_info: dict = attr.ib()
|
||||
automation_info: AutomationTriggerInfo = attr.ib()
|
||||
trigger: Trigger = attr.ib()
|
||||
remove: CALLBACK_TYPE | None = attr.ib(default=None)
|
||||
|
||||
|
@ -316,7 +319,7 @@ async def async_attach_trigger(
|
|||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
action: AutomationActionType,
|
||||
automation_info: dict,
|
||||
automation_info: AutomationTriggerInfo,
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Attach a trigger."""
|
||||
if DEVICE_TRIGGERS not in hass.data:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue