From c4459a3cf5102108c793318ed6a39bd9d0a988b9 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Sat, 7 Sep 2024 16:31:41 +0200 Subject: [PATCH] chore: add missing typing (#302) * chore: add missing typing * chore: few more typing --- custom_components/midea_ac_lan/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/midea_ac_lan/__init__.py b/custom_components/midea_ac_lan/__init__.py index aba2b3d..852fe78 100644 --- a/custom_components/midea_ac_lan/__init__.py +++ b/custom_components/midea_ac_lan/__init__.py @@ -30,7 +30,7 @@ ) from homeassistant.core import HomeAssistant from homeassistant.helpers.typing import ConfigType -from midealocal.device import DeviceType, ProtocolVersion +from midealocal.device import DeviceType, MideaDevice, ProtocolVersion from midealocal.devices import device_selector from .const import ( @@ -63,11 +63,11 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> Non hass.async_create_task( hass.config_entries.async_forward_entry_setups(config_entry, ALL_PLATFORM), ) - device_id = config_entry.data.get(CONF_DEVICE_ID) + device_id: int = cast(int, config_entry.data.get(CONF_DEVICE_ID)) customize = config_entry.options.get(CONF_CUSTOMIZE, "") ip_address = config_entry.options.get(CONF_IP_ADDRESS, None) refresh_interval = config_entry.options.get(CONF_REFRESH_INTERVAL, None) - dev = hass.data[DOMAIN][DEVICES].get(device_id) + dev: MideaDevice = hass.data[DOMAIN][DEVICES].get(device_id) if dev: dev.set_customize(customize) if ip_address is not None: @@ -99,10 +99,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: def service_set_attribute(service: Any) -> None: # noqa: ANN401 """Set service attribute func.""" - device_id = service.data["device_id"] + device_id: int = service.data["device_id"] attr = service.data["attribute"] value = service.data["value"] - dev = hass.data[DOMAIN][DEVICES].get(device_id) + dev: MideaDevice = hass.data[DOMAIN][DEVICES].get(device_id) if dev: if attr == "fan_speed" and value == "auto": value = 102