diff --git a/homeassistant/components/fan/device_action.py b/homeassistant/components/fan/device_action.py index fd38c69c3da..55bd862349b 100644 --- a/homeassistant/components/fan/device_action.py +++ b/homeassistant/components/fan/device_action.py @@ -6,6 +6,7 @@ import voluptuous as vol from homeassistant.components.device_automation import toggle_entity from homeassistant.const import CONF_DOMAIN from homeassistant.core import Context, HomeAssistant +from homeassistant.helpers.typing import ConfigType, TemplateVarsType from . import DOMAIN @@ -20,7 +21,10 @@ async def async_get_actions( async def async_call_action_from_config( - hass: HomeAssistant, config: dict, variables: dict, context: Context | None + hass: HomeAssistant, + config: ConfigType, + variables: TemplateVarsType, + context: Context | None, ) -> None: """Execute a device action.""" await toggle_entity.async_call_action_from_config( diff --git a/homeassistant/components/fan/device_trigger.py b/homeassistant/components/fan/device_trigger.py index 1d81ef18f4d..35eb5a9f50c 100644 --- a/homeassistant/components/fan/device_trigger.py +++ b/homeassistant/components/fan/device_trigger.py @@ -1,8 +1,6 @@ """Provides device automations for Fan.""" from __future__ import annotations -from typing import Any - import voluptuous as vol from homeassistant.components.automation import ( @@ -24,7 +22,7 @@ TRIGGER_SCHEMA = vol.All( async def async_get_triggers( hass: HomeAssistant, device_id: str -) -> list[dict[str, Any]]: +) -> list[dict[str, str]]: """List device triggers for Fan devices.""" return await toggle_entity.async_get_triggers(hass, device_id, DOMAIN) diff --git a/homeassistant/components/humidifier/device_action.py b/homeassistant/components/humidifier/device_action.py index 03f0bb1fea1..773caa72f95 100644 --- a/homeassistant/components/humidifier/device_action.py +++ b/homeassistant/components/humidifier/device_action.py @@ -1,8 +1,6 @@ """Provides device actions for Humidifier.""" from __future__ import annotations -from typing import Any - import voluptuous as vol from homeassistant.components.device_automation import toggle_entity @@ -19,6 +17,7 @@ from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity_registry import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import get_capability, get_supported_features +from homeassistant.helpers.typing import ConfigType, TemplateVarsType from . import DOMAIN, const @@ -74,8 +73,8 @@ async def async_get_actions( async def async_call_action_from_config( hass: HomeAssistant, - config: dict[str, Any], - variables: dict[str, Any], + config: ConfigType, + variables: TemplateVarsType, context: Context | None, ) -> None: """Execute a device action.""" @@ -97,7 +96,9 @@ async def async_call_action_from_config( ) -async def async_get_action_capabilities(hass, config): +async def async_get_action_capabilities( + hass: HomeAssistant, config: ConfigType +) -> dict[str, vol.Schema]: """List action capabilities.""" action_type = config[CONF_TYPE] diff --git a/homeassistant/components/humidifier/device_condition.py b/homeassistant/components/humidifier/device_condition.py index b8e8d2a13ae..949b25fdd15 100644 --- a/homeassistant/components/humidifier/device_condition.py +++ b/homeassistant/components/humidifier/device_condition.py @@ -85,7 +85,9 @@ def async_condition_from_config( return test_is_state -async def async_get_condition_capabilities(hass, config): +async def async_get_condition_capabilities( + hass: HomeAssistant, config: ConfigType +) -> dict[str, vol.Schema]: """List condition capabilities.""" condition_type = config[CONF_TYPE] diff --git a/homeassistant/components/humidifier/device_trigger.py b/homeassistant/components/humidifier/device_trigger.py index a2d15097335..e8f3a0ac446 100644 --- a/homeassistant/components/humidifier/device_trigger.py +++ b/homeassistant/components/humidifier/device_trigger.py @@ -1,8 +1,6 @@ """Provides device automations for Climate.""" from __future__ import annotations -from typing import Any - import voluptuous as vol from homeassistant.components.automation import ( @@ -59,7 +57,7 @@ TRIGGER_SCHEMA = vol.All( async def async_get_triggers( hass: HomeAssistant, device_id: str -) -> list[dict[str, Any]]: +) -> list[dict[str, str]]: """List device triggers for Humidifier devices.""" registry = entity_registry.async_get(hass) triggers = await toggle_entity.async_get_triggers(hass, device_id, DOMAIN) diff --git a/homeassistant/components/light/device_action.py b/homeassistant/components/light/device_action.py index 285e34ebe08..2583bfa972f 100644 --- a/homeassistant/components/light/device_action.py +++ b/homeassistant/components/light/device_action.py @@ -55,7 +55,7 @@ async def async_call_action_from_config( hass: HomeAssistant, config: ConfigType, variables: TemplateVarsType, - context: Context, + context: Context | None, ) -> None: """Change state based on configuration.""" if ( diff --git a/homeassistant/components/light/device_trigger.py b/homeassistant/components/light/device_trigger.py index 5b4083f41a6..6f5f5fd7f52 100644 --- a/homeassistant/components/light/device_trigger.py +++ b/homeassistant/components/light/device_trigger.py @@ -1,8 +1,6 @@ """Provides device trigger for lights.""" from __future__ import annotations -from typing import Any - import voluptuous as vol from homeassistant.components.automation import ( @@ -36,7 +34,7 @@ async def async_attach_trigger( async def async_get_triggers( hass: HomeAssistant, device_id: str -) -> list[dict[str, Any]]: +) -> list[dict[str, str]]: """List device triggers.""" return await toggle_entity.async_get_triggers(hass, device_id, DOMAIN) diff --git a/homeassistant/components/lock/device_action.py b/homeassistant/components/lock/device_action.py index 038c2f1c0da..3ff8d10c7a2 100644 --- a/homeassistant/components/lock/device_action.py +++ b/homeassistant/components/lock/device_action.py @@ -17,6 +17,7 @@ from homeassistant.core import Context, HomeAssistant from homeassistant.helpers import entity_registry import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import get_supported_features +from homeassistant.helpers.typing import ConfigType, TemplateVarsType from . import DOMAIN, LockEntityFeature @@ -61,7 +62,10 @@ async def async_get_actions( async def async_call_action_from_config( - hass: HomeAssistant, config: dict, variables: dict, context: Context | None + hass: HomeAssistant, + config: ConfigType, + variables: TemplateVarsType, + context: Context | None, ) -> None: """Execute a device action.""" service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]} diff --git a/homeassistant/components/lock/device_trigger.py b/homeassistant/components/lock/device_trigger.py index d875cadb446..b55a2ac254b 100644 --- a/homeassistant/components/lock/device_trigger.py +++ b/homeassistant/components/lock/device_trigger.py @@ -1,8 +1,6 @@ """Provides device automations for Lock.""" from __future__ import annotations -from typing import Any - import voluptuous as vol from homeassistant.components.automation import ( @@ -43,7 +41,7 @@ TRIGGER_SCHEMA = DEVICE_TRIGGER_BASE_SCHEMA.extend( async def async_get_triggers( hass: HomeAssistant, device_id: str -) -> list[dict[str, Any]]: +) -> list[dict[str, str]]: """List device triggers for Lock devices.""" registry = entity_registry.async_get(hass) triggers = [] diff --git a/homeassistant/components/media_player/device_trigger.py b/homeassistant/components/media_player/device_trigger.py index 9644e5e0010..e0c88489841 100644 --- a/homeassistant/components/media_player/device_trigger.py +++ b/homeassistant/components/media_player/device_trigger.py @@ -1,8 +1,6 @@ """Provides device automations for Media player.""" from __future__ import annotations -from typing import Any - import voluptuous as vol from homeassistant.components.automation import ( @@ -55,7 +53,7 @@ TRIGGER_SCHEMA = vol.All( async def async_get_triggers( hass: HomeAssistant, device_id: str -) -> list[dict[str, Any]]: +) -> list[dict[str, str]]: """List device triggers for Media player entities.""" registry = entity_registry.async_get(hass) triggers = await entity.async_get_triggers(hass, device_id, DOMAIN) diff --git a/homeassistant/components/mobile_app/device_action.py b/homeassistant/components/mobile_app/device_action.py index d17702ec24f..f6e870fc7d6 100644 --- a/homeassistant/components/mobile_app/device_action.py +++ b/homeassistant/components/mobile_app/device_action.py @@ -9,6 +9,7 @@ from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_TYPE from homeassistant.core import Context, HomeAssistant from homeassistant.exceptions import TemplateError from homeassistant.helpers import config_validation as cv, template +from homeassistant.helpers.typing import ConfigType, TemplateVarsType from .const import DOMAIN from .util import get_notify_service, supports_push, webhook_id_from_device_id @@ -36,7 +37,10 @@ async def async_get_actions( async def async_call_action_from_config( - hass: HomeAssistant, config: dict, variables: dict, context: Context | None + hass: HomeAssistant, + config: ConfigType, + variables: TemplateVarsType, + context: Context | None, ) -> None: """Execute a device action.""" webhook_id = webhook_id_from_device_id(hass, config[CONF_DEVICE_ID]) @@ -73,7 +77,9 @@ async def async_call_action_from_config( ) -async def async_get_action_capabilities(hass, config): +async def async_get_action_capabilities( + hass: HomeAssistant, config: ConfigType +) -> dict[str, vol.Schema]: """List action capabilities.""" if config[CONF_TYPE] != "notify": return {} diff --git a/homeassistant/components/number/device_action.py b/homeassistant/components/number/device_action.py index 3d449ffc213..e4311f50dd2 100644 --- a/homeassistant/components/number/device_action.py +++ b/homeassistant/components/number/device_action.py @@ -13,7 +13,7 @@ from homeassistant.const import ( from homeassistant.core import Context, HomeAssistant from homeassistant.helpers import entity_registry import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, TemplateVarsType from .const import ATTR_VALUE, DOMAIN, SERVICE_SET_VALUE @@ -53,7 +53,10 @@ async def async_get_actions( async def async_call_action_from_config( - hass: HomeAssistant, config: dict, variables: dict, context: Context | None + hass: HomeAssistant, + config: ConfigType, + variables: TemplateVarsType, + context: Context | None, ) -> None: """Execute a device action.""" await hass.services.async_call(