diff --git a/homeassistant/components/rfxtrx/device_action.py b/homeassistant/components/rfxtrx/device_action.py index 37fb39cb499..e8fc8c6707d 100644 --- a/homeassistant/components/rfxtrx/device_action.py +++ b/homeassistant/components/rfxtrx/device_action.py @@ -9,6 +9,7 @@ from homeassistant.components.device_automation.exceptions import ( from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_TYPE from homeassistant.core import Context, HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType, TemplateVarsType from . import DATA_RFXOBJECT, DOMAIN from .helpers import async_get_device_object @@ -37,7 +38,9 @@ ACTION_SCHEMA = cv.DEVICE_ACTION_BASE_SCHEMA.extend( ) -async def async_get_actions(hass: HomeAssistant, device_id: str) -> list[dict]: +async def async_get_actions( + hass: HomeAssistant, device_id: str +) -> list[dict[str, str]]: """List device actions for RFXCOM RFXtrx devices.""" try: @@ -48,8 +51,8 @@ async def async_get_actions(hass: HomeAssistant, device_id: str) -> list[dict]: actions = [] for action_type in ACTION_TYPES: if hasattr(device, action_type): - values = getattr(device, ACTION_SELECTION[action_type], {}) - for value in values.values(): + data: dict[int, str] = getattr(device, ACTION_SELECTION[action_type], {}) + for value in data.values(): actions.append( { CONF_DEVICE_ID: device_id, @@ -69,7 +72,9 @@ def _get_commands(hass, device_id, action_type): return commands, send_fun -async def async_validate_action_config(hass, config): +async def async_validate_action_config( + hass: HomeAssistant, config: ConfigType +) -> ConfigType: """Validate config.""" config = ACTION_SCHEMA(config) commands, _ = _get_commands(hass, config[CONF_DEVICE_ID], config[CONF_TYPE]) @@ -84,7 +89,10 @@ async def async_validate_action_config(hass, config): 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.""" config = ACTION_SCHEMA(config) diff --git a/homeassistant/components/rfxtrx/device_trigger.py b/homeassistant/components/rfxtrx/device_trigger.py index 9ab10ca7f2b..196377dd60f 100644 --- a/homeassistant/components/rfxtrx/device_trigger.py +++ b/homeassistant/components/rfxtrx/device_trigger.py @@ -47,13 +47,15 @@ TRIGGER_SCHEMA = DEVICE_TRIGGER_BASE_SCHEMA.extend( ) -async def async_get_triggers(hass: HomeAssistant, device_id: str) -> list[dict]: +async def async_get_triggers( + hass: HomeAssistant, device_id: str +) -> list[dict[str, str]]: """List device triggers for RFXCOM RFXtrx devices.""" device = async_get_device_object(hass, device_id) triggers = [] for conf_type in TRIGGER_TYPES: - data = getattr(device, TRIGGER_SELECTION[conf_type], {}) + data: dict[int, str] = getattr(device, TRIGGER_SELECTION[conf_type], {}) for command in data.values(): triggers.append( { @@ -67,7 +69,9 @@ async def async_get_triggers(hass: HomeAssistant, device_id: str) -> list[dict]: return triggers -async def async_validate_trigger_config(hass, config): +async def async_validate_trigger_config( + hass: HomeAssistant, config: ConfigType +) -> ConfigType: """Validate config.""" config = TRIGGER_SCHEMA(config)