Adjust device_automation type hints in rfxtrx (#72138)

This commit is contained in:
epenet 2022-05-23 14:32:47 +02:00 committed by GitHub
parent 6ec755a79d
commit dfc8dee2d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 8 deletions

View file

@ -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)