From 7ce3e9ad7b3834f8c054058d9c42f1e51b687b1f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 19 May 2022 21:33:50 +0200 Subject: [PATCH] Adjust device_automation type hints in shelly (#72196) --- homeassistant/components/shelly/device_trigger.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/shelly/device_trigger.py b/homeassistant/components/shelly/device_trigger.py index ae2eb7d6440..1231f670d49 100644 --- a/homeassistant/components/shelly/device_trigger.py +++ b/homeassistant/components/shelly/device_trigger.py @@ -1,7 +1,7 @@ """Provides device triggers for Shelly.""" from __future__ import annotations -from typing import Any, Final +from typing import Final import voluptuous as vol @@ -9,7 +9,10 @@ from homeassistant.components.automation import ( AutomationActionType, AutomationTriggerInfo, ) -from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA +from homeassistant.components.device_automation import ( + DEVICE_TRIGGER_BASE_SCHEMA, + GetAutomationsResult, +) from homeassistant.components.device_automation.exceptions import ( InvalidDeviceAutomationConfig, ) @@ -72,8 +75,8 @@ def append_input_triggers( async def async_validate_trigger_config( - hass: HomeAssistant, config: dict[str, Any] -) -> dict[str, Any]: + hass: HomeAssistant, config: ConfigType +) -> ConfigType: """Validate config.""" config = TRIGGER_SCHEMA(config) @@ -108,9 +111,9 @@ async def async_validate_trigger_config( async def async_get_triggers( hass: HomeAssistant, device_id: str -) -> list[dict[str, str]]: +) -> GetAutomationsResult: """List device triggers for Shelly devices.""" - triggers: list[dict[str, str]] = [] + triggers: GetAutomationsResult = [] if rpc_wrapper := get_rpc_device_wrapper(hass, device_id): input_triggers = get_rpc_input_triggers(rpc_wrapper.device)