Use AddEntitiesCallback type, pt.4 (#49955)
This commit is contained in:
parent
a0feee083c
commit
786c5db5be
14 changed files with 37 additions and 48 deletions
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Callable
|
||||
|
||||
import herepy
|
||||
import voluptuous as vol
|
||||
|
@ -26,6 +25,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant, State, callback
|
||||
from homeassistant.helpers import location
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt
|
||||
|
||||
|
@ -145,7 +145,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: dict[str, str | bool],
|
||||
async_add_entities: Callable,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the HERE travel time platform."""
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
"""Support for KNX/IP binary sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from xknx.devices import BinarySensor as XknxBinarySensor
|
||||
|
||||
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import dt
|
||||
|
||||
|
@ -19,7 +18,7 @@ from .knx_entity import KnxEntity
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up binary sensor(s) for KNX platform."""
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""Support for KNX/IP climate devices."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from xknx.devices import Climate as XknxClimate
|
||||
from xknx.dpt.dpt_hvac_mode import HVACControllerMode, HVACOperationMode
|
||||
|
@ -19,7 +18,7 @@ from homeassistant.components.climate.const import (
|
|||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import CONTROLLER_MODES, DOMAIN, PRESET_MODES
|
||||
|
@ -33,7 +32,7 @@ PRESET_MODES_INV = {value: key for key, value in PRESET_MODES.items()}
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up climate(s) for KNX platform."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Support for KNX/IP covers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable
|
||||
|
||||
|
@ -25,7 +24,7 @@ from homeassistant.components.cover import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import async_track_utc_time_change
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
|
@ -37,7 +36,7 @@ from .schema import CoverSchema
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up cover(s) for KNX platform."""
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
"""Support for KNX/IP fans."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
import math
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from xknx.devices import Fan as XknxFan
|
||||
|
||||
from homeassistant.components.fan import SUPPORT_OSCILLATE, SUPPORT_SET_SPEED, FanEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util.percentage import (
|
||||
int_states_in_range,
|
||||
|
@ -26,7 +25,7 @@ DEFAULT_PERCENTAGE = 50
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up fans for KNX platform."""
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""Support for KNX/IP lights."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable, cast
|
||||
from typing import Any, cast
|
||||
|
||||
from xknx.devices import Light as XknxLight
|
||||
from xknx.telegram.address import parse_device_group_address
|
||||
|
@ -21,7 +20,7 @@ from homeassistant.components.light import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
|
@ -33,7 +32,7 @@ from .schema import LightSchema
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up lights for KNX platform."""
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
"""Support for KNX scenes."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from xknx.devices import Scene as XknxScene
|
||||
|
||||
from homeassistant.components.scene import Scene
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -18,7 +17,7 @@ from .knx_entity import KnxEntity
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the scenes for KNX platform."""
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
"""Support for KNX/IP sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from xknx.devices import Sensor as XknxSensor
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, StateType
|
||||
from homeassistant.util import dt
|
||||
|
||||
|
@ -19,7 +18,7 @@ from .knx_entity import KnxEntity
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up sensor(s) for KNX platform."""
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""Support for KNX/IP switches."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
from xknx import XKNX
|
||||
from xknx.devices import Switch as XknxSwitch
|
||||
|
@ -10,7 +9,7 @@ from xknx.devices import Switch as XknxSwitch
|
|||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import DOMAIN, KNX_ADDRESS
|
||||
|
@ -21,7 +20,7 @@ from .schema import SwitchSchema
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up switch(es) for KNX platform."""
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
"""Support for KNX/IP weather station."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Callable
|
||||
|
||||
from xknx.devices import Weather as XknxWeather
|
||||
|
||||
from homeassistant.components.weather import WeatherEntity
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -19,7 +16,7 @@ from .knx_entity import KnxEntity
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Iterable[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up weather entities for KNX platform."""
|
||||
|
|
|
@ -21,6 +21,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import StateType
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
|
@ -98,7 +99,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigEntry,
|
||||
async_add_entities: Callable[[], Coroutine],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info=None,
|
||||
) -> None:
|
||||
"""Import the platform into a config entry."""
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""Light support for switch entities."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, Callable, cast
|
||||
from typing import Any, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -17,7 +16,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant, State, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
|
@ -36,7 +35,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Sequence[Entity]], None],
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Initialize Light Switch platform."""
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Home Assistant Switcher Component Switch platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Callable
|
||||
|
||||
from aioswitcher.api import SwitcherV2Api
|
||||
from aioswitcher.api.messages import SwitcherV2ControlResponseMSG
|
||||
from aioswitcher.consts import (
|
||||
|
@ -19,6 +17,7 @@ from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchEntity
|
|||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import (
|
||||
ATTR_AUTO_OFF_SET,
|
||||
|
@ -55,7 +54,7 @@ SERVICE_TURN_ON_WITH_TIMER_SCHEMA = {
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: dict,
|
||||
async_add_entities: Callable,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: dict,
|
||||
) -> None:
|
||||
"""Set up the switcher platform for the switch component."""
|
||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
|||
import os
|
||||
import socket
|
||||
import sys
|
||||
from typing import Any, Callable, cast
|
||||
from typing import Any, cast
|
||||
|
||||
import psutil
|
||||
import voluptuous as vol
|
||||
|
@ -36,6 +36,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity_component import DEFAULT_SCAN_INTERVAL
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import slugify
|
||||
|
@ -198,7 +199,7 @@ class SensorData:
|
|||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: Any | None = None,
|
||||
) -> None:
|
||||
"""Set up the system monitor sensors."""
|
||||
|
|
Loading…
Add table
Reference in a new issue