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
|
@ -2,7 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any, Awaitable, Callable, Dict, cast
|
||||
from typing import Any, Awaitable, Callable, Dict, TypedDict, cast
|
||||
|
||||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
@ -106,6 +106,23 @@ _LOGGER = logging.getLogger(__name__)
|
|||
AutomationActionType = Callable[[HomeAssistant, TemplateVarsType], Awaitable[None]]
|
||||
|
||||
|
||||
class AutomationTriggerData(TypedDict):
|
||||
"""Automation trigger data."""
|
||||
|
||||
id: str
|
||||
idx: str
|
||||
|
||||
|
||||
class AutomationTriggerInfo(TypedDict):
|
||||
"""Information about automation trigger."""
|
||||
|
||||
domain: str
|
||||
name: str
|
||||
home_assistant_start: bool
|
||||
variables: TemplateVarsType
|
||||
trigger_data: AutomationTriggerData
|
||||
|
||||
|
||||
@bind_hass
|
||||
def is_on(hass, entity_id):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue