mirror of
https://github.com/home-assistant/core.git
synced 2025-11-17 15:00:12 +00:00
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:
@@ -9,7 +9,10 @@ from aiohomekit.model.services import ServicesTypes
|
||||
from aiohomekit.utils import clamp_enum_to_char
|
||||
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_ID, CONF_DOMAIN, CONF_PLATFORM, CONF_TYPE
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
@@ -75,12 +78,10 @@ class TriggerSource:
|
||||
self,
|
||||
config: TRIGGER_SCHEMA,
|
||||
action: AutomationActionType,
|
||||
automation_info: dict,
|
||||
automation_info: AutomationTriggerInfo,
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Attach a trigger."""
|
||||
trigger_data = (
|
||||
automation_info.get("trigger_data", {}) if automation_info else {}
|
||||
)
|
||||
trigger_data = automation_info["trigger_data"]
|
||||
|
||||
def event_handler(char):
|
||||
if config[CONF_SUBTYPE] != HK_TO_HA_INPUT_EVENT_VALUES[char["value"]]:
|
||||
@@ -260,7 +261,7 @@ async def async_attach_trigger(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
action: AutomationActionType,
|
||||
automation_info: dict,
|
||||
automation_info: AutomationTriggerInfo,
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Attach a trigger."""
|
||||
device_id = config[CONF_DEVICE_ID]
|
||||
|
||||
Reference in New Issue
Block a user