Add setup type hints [a-e] (#63597)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/62725/head
parent
56692b5a2a
commit
a08b758bfb
homeassistant/components
alarmdecoder
asuswrt
control4
digitalloggers
evohome
|
@ -22,6 +22,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import (
|
||||
CONF_ALT_NIGHT_MODE,
|
||||
|
@ -41,8 +42,8 @@ ATTR_KEYPRESS = "keypress"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
):
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up for AlarmDecoder alarm panels."""
|
||||
options = entry.options
|
||||
arm_options = options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS)
|
||||
|
|
|
@ -4,6 +4,7 @@ import logging
|
|||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import (
|
||||
CONF_RELAY_ADDR,
|
||||
|
@ -34,8 +35,8 @@ ATTR_RF_LOOP1 = "rf_loop1"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
):
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up for AlarmDecoder sensor."""
|
||||
|
||||
zones = entry.options.get(OPTIONS_ZONES, DEFAULT_ZONE_OPTIONS)
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import SIGNAL_PANEL_MESSAGE
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
) -> bool:
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up for AlarmDecoder sensor."""
|
||||
|
||||
entity = AlarmDecoderSensor()
|
||||
async_add_entities([entity])
|
||||
return True
|
||||
|
||||
|
||||
class AlarmDecoderSensor(SensorEntity):
|
||||
|
|
|
@ -6,6 +6,7 @@ from homeassistant.components.device_tracker.config_entry import ScannerEntity
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import DATA_ASUSWRT, DOMAIN
|
||||
from .router import AsusWrtRouter
|
||||
|
@ -14,7 +15,7 @@ DEFAULT_DEVICE_NAME = "Unknown device"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up device tracker for AsusWrt component."""
|
||||
router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
||||
|
|
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -157,7 +158,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up the sensors."""
|
||||
router: AsusWrtRouter = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
||||
|
|
|
@ -18,6 +18,7 @@ from homeassistant.components.light import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_SCAN_INTERVAL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
from . import Control4Entity, get_items_of_category
|
||||
|
@ -32,8 +33,8 @@ CONTROL4_DIMMER_VAR = "LIGHT_LEVEL"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
):
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up Control4 lights from a config entry."""
|
||||
entry_data = hass.data[DOMAIN][entry.entry_id]
|
||||
scan_interval = entry_data[CONF_SCAN_INTERVAL]
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for Digital Loggers DIN III Relays."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
|
@ -13,7 +15,10 @@ from homeassistant.const import (
|
|||
CONF_TIMEOUT,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -44,7 +49,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Find and return DIN III Relay switch."""
|
||||
|
||||
host = config[CONF_HOST]
|
||||
|
@ -60,16 +70,16 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
|
||||
if not power_switch.verify():
|
||||
_LOGGER.error("Could not connect to DIN III Relay")
|
||||
return False
|
||||
return
|
||||
|
||||
outlets = []
|
||||
entities: list[DINRelay] = []
|
||||
parent_device = DINRelayDevice(power_switch)
|
||||
|
||||
outlets.extend(
|
||||
entities.extend(
|
||||
DINRelay(controller_name, parent_device, outlet) for outlet in power_switch[0:]
|
||||
)
|
||||
|
||||
add_entities(outlets)
|
||||
add_entities(entities)
|
||||
|
||||
|
||||
class DINRelay(SwitchEntity):
|
||||
|
|
|
@ -18,7 +18,8 @@ from homeassistant.components.climate.const import (
|
|||
)
|
||||
from homeassistant.const import PRECISION_TENTHS
|
||||
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
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import (
|
||||
|
@ -76,7 +77,10 @@ STATE_ATTRS_ZONES = ["zoneId", "activeFaults", "setpointStatus", "temperatureSta
|
|||
|
||||
|
||||
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:
|
||||
"""Create the evohome Controller, and its Zones, if any."""
|
||||
if discovery_info is None:
|
||||
|
|
|
@ -10,7 +10,8 @@ from homeassistant.components.water_heater import (
|
|||
)
|
||||
from homeassistant.const import PRECISION_TENTHS, PRECISION_WHOLE, STATE_OFF, STATE_ON
|
||||
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
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import EvoChild
|
||||
|
@ -27,7 +28,10 @@ STATE_ATTRS_DHW = ["dhwId", "activeFaults", "stateStatus", "temperatureStatus"]
|
|||
|
||||
|
||||
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:
|
||||
"""Create a DHW controller."""
|
||||
if discovery_info is None:
|
||||
|
|
Loading…
Reference in New Issue