Add basic type hints to xiaomi_miio (#62889)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-28 00:15:40 +01:00 committed by GitHub
parent de64622f3b
commit cb135bc889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 102 additions and 24 deletions

View file

@ -15,6 +15,7 @@ from homeassistant.components.switch import (
SwitchEntity,
SwitchEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_MODE,
@ -22,9 +23,10 @@ from homeassistant.const import (
CONF_HOST,
CONF_TOKEN,
)
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, ServiceCall, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import (
CONF_DEVICE,
@ -274,7 +276,11 @@ SWITCH_TYPES = (
)
async def async_setup_entry(hass, config_entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the switch from a config entry."""
model = config_entry.data[CONF_MODEL]
if model in (*MODELS_HUMIDIFIER, *MODELS_FAN):
@ -405,7 +411,7 @@ async def async_setup_other_entry(hass, config_entry, async_add_entities):
model,
)
async def async_service_handler(service):
async def async_service_handler(service: ServiceCall) -> None:
"""Map services to methods on XiaomiPlugGenericSwitch."""
method = SERVICE_TO_METHOD.get(service.service)
params = {