strictly type: fan.py, light.py, switch.py. (#56379)

This commit is contained in:
jan iversen 2021-09-23 19:35:50 +02:00 committed by GitHub
parent cce906f968
commit 1cc850877f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 13 deletions

View file

@ -2,11 +2,13 @@
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.switch import SwitchEntity
from homeassistant.const import CONF_NAME, CONF_SWITCHES
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import get_hub
from .base_platform import BaseSwitch
@ -17,8 +19,11 @@ _LOGGER = logging.getLogger(__name__)
async def async_setup_platform(
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
):
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Read configuration and create Modbus switches."""
switches = []
@ -34,6 +39,6 @@ async def async_setup_platform(
class ModbusSwitch(BaseSwitch, SwitchEntity):
"""Base class representing a Modbus switch."""
async def async_turn_on(self, **kwargs):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Set switch on."""
await self.async_turn(self.command_on)