Add setup type hints to number, remote and scene (#63299)
* Add number setup type hints * Add remote setup type hints * Add scene setup type hints Co-authored-by: epenet <epenet@users.noreply.github.com>pull/63311/head
parent
1995a825f3
commit
5ddab5a7f2
|
@ -1,5 +1,4 @@
|
||||||
"""Remote control support for Apple TV."""
|
"""Remote control support for Apple TV."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -9,7 +8,10 @@ from homeassistant.components.remote import (
|
||||||
DEFAULT_DELAY_SECS,
|
DEFAULT_DELAY_SECS,
|
||||||
RemoteEntity,
|
RemoteEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import AppleTVEntity
|
from . import AppleTVEntity
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -19,7 +21,11 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
PARALLEL_UPDATES = 0
|
PARALLEL_UPDATES = 0
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
"""Load Apple TV remote based on a config entry."""
|
"""Load Apple TV remote based on a config entry."""
|
||||||
name = config_entry.data[CONF_NAME]
|
name = config_entry.data[CONF_NAME]
|
||||||
manager = hass.data[DOMAIN][config_entry.unique_id]
|
manager = hass.data[DOMAIN][config_entry.unique_id]
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
"""Support for Fibaro scenes."""
|
"""Support for Fibaro scenes."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import FIBARO_DEVICES, FibaroDevice
|
from . import FIBARO_DEVICES, FibaroDevice
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Perform the setup for Fibaro scenes."""
|
"""Perform the setup for Fibaro scenes."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
"""Support for Powerview scenes from a Powerview hub."""
|
"""Support for Powerview scenes from a Powerview hub."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aiopvapi.resources.scene import Scene as PvScene
|
from aiopvapi.resources.scene import Scene as PvScene
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, CONF_PLATFORM
|
from homeassistant.const import CONF_HOST, CONF_PLATFORM
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
COORDINATOR,
|
COORDINATOR,
|
||||||
|
@ -27,7 +32,12 @@ PLATFORM_SCHEMA = vol.Schema(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Import platform from yaml."""
|
"""Import platform from yaml."""
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
|
@ -39,7 +49,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry, async_add_entities):
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
"""Set up powerview scene entries."""
|
"""Set up powerview scene entries."""
|
||||||
|
|
||||||
pv_data = hass.data[DOMAIN][entry.entry_id]
|
pv_data = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
|
@ -2,13 +2,20 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
ATTR_NUMBER = "number"
|
ATTR_NUMBER = "number"
|
||||||
|
|
||||||
|
|
||||||
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 entry."""
|
"""Set up entry."""
|
||||||
|
|
||||||
system = hass.data[DOMAIN]
|
system = hass.data[DOMAIN]
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
"""Support for Lutron scenes."""
|
"""Support for Lutron scenes."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
|
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
"""Set up the Lutron scenes."""
|
"""Set up the Lutron scenes."""
|
||||||
devs = []
|
devs = []
|
||||||
for scene_data in hass.data[LUTRON_DEVICES]["scene"]:
|
for scene_data in hass.data[LUTRON_DEVICES]["scene"]:
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import BRIDGE_LEAP, DOMAIN as CASETA_DOMAIN
|
from .const import BRIDGE_LEAP, DOMAIN as CASETA_DOMAIN
|
||||||
|
|
||||||
|
|
||||||
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 Lutron Caseta scene platform.
|
"""Set up the Lutron Caseta scene platform.
|
||||||
|
|
||||||
Adds scenes from the Caseta bridge associated with the config_entry as
|
Adds scenes from the Caseta bridge associated with the config_entry as
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
"""Support for Nexia Automations."""
|
"""Support for Nexia Automations."""
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
|
|
||||||
from .const import ATTR_DESCRIPTION, DOMAIN
|
from .const import ATTR_DESCRIPTION, DOMAIN
|
||||||
|
@ -12,7 +14,11 @@ from .entity import NexiaEntity
|
||||||
SCENE_ACTIVATION_TIME = 5
|
SCENE_ACTIVATION_TIME = 5
|
||||||
|
|
||||||
|
|
||||||
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 automations for a Nexia device."""
|
"""Set up automations for a Nexia device."""
|
||||||
coordinator: NexiaDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator: NexiaDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
nexia_home = coordinator.nexia_home
|
nexia_home = coordinator.nexia_home
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.remote import RemoteEntity
|
from homeassistant.components.remote import RemoteEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_NAME, STATE_ON
|
from homeassistant.const import CONF_NAME, STATE_ON
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_DEVICE_INFO,
|
ATTR_DEVICE_INFO,
|
||||||
|
@ -17,7 +20,11 @@ from .const import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 Panasonic Viera TV Remote from a config entry."""
|
"""Set up Panasonic Viera TV Remote from a config entry."""
|
||||||
|
|
||||||
config = config_entry.data
|
config = config_entry.data
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Remote control support for Apple TV."""
|
"""Remote control support for Apple TV."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from haphilipsjs.typing import SystemType
|
from haphilipsjs.typing import SystemType
|
||||||
|
@ -10,13 +9,20 @@ from homeassistant.components.remote import (
|
||||||
DEFAULT_DELAY_SECS,
|
DEFAULT_DELAY_SECS,
|
||||||
RemoteEntity,
|
RemoteEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import LOGGER, PhilipsTVDataUpdateCoordinator
|
from . import LOGGER, PhilipsTVDataUpdateCoordinator
|
||||||
from .const import CONF_SYSTEM, DOMAIN
|
from .const import CONF_SYSTEM, DOMAIN
|
||||||
|
|
||||||
|
|
||||||
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 configuration entry."""
|
"""Set up the configuration entry."""
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
|
|
|
@ -4,6 +4,9 @@ import logging
|
||||||
from screenlogicpy.const import BODY_TYPE, DATA as SL_DATA, EQUIPMENT, SCG
|
from screenlogicpy.const import BODY_TYPE, DATA as SL_DATA, EQUIPMENT, SCG
|
||||||
|
|
||||||
from homeassistant.components.number import NumberEntity
|
from homeassistant.components.number import NumberEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import ScreenlogicEntity
|
from . import ScreenlogicEntity
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -18,7 +21,11 @@ SUPPORTED_SCG_NUMBERS = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 entry."""
|
"""Set up entry."""
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
equipment_flags = coordinator.data[SL_DATA.KEY_CONFIG]["equipment_flags"]
|
equipment_flags = coordinator.data[SL_DATA.KEY_CONFIG]["equipment_flags"]
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DATA_BROKERS, DOMAIN
|
from .const import DATA_BROKERS, DOMAIN
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
"""Add switches for a config entry."""
|
"""Add switches for a config entry."""
|
||||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||||
async_add_entities([SmartThingsScene(scene) for scene in broker.scenes.values()])
|
async_add_entities([SmartThingsScene(scene) for scene in broker.scenes.values()])
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import UpbEntity
|
from . import UpbEntity
|
||||||
from .const import DOMAIN, UPB_BLINK_RATE_SCHEMA, UPB_BRIGHTNESS_RATE_SCHEMA
|
from .const import DOMAIN, UPB_BLINK_RATE_SCHEMA, UPB_BRIGHTNESS_RATE_SCHEMA
|
||||||
|
@ -14,7 +17,11 @@ SERVICE_LINK_FADE_START = "link_fade_start"
|
||||||
SERVICE_LINK_BLINK = "link_blink"
|
SERVICE_LINK_BLINK = "link_blink"
|
||||||
|
|
||||||
|
|
||||||
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 UPB link based on a config entry."""
|
"""Set up the UPB link based on a config entry."""
|
||||||
upb = hass.data[DOMAIN][config_entry.entry_id]["upb"]
|
upb = hass.data[DOMAIN][config_entry.entry_id]["upb"]
|
||||||
unique_id = config_entry.entry_id
|
unique_id = config_entry.entry_id
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
"""Support for VELUX scenes."""
|
"""Support for VELUX scenes."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import _LOGGER, DATA_VELUX
|
from . import _LOGGER, DATA_VELUX
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up the scenes for Velux platform."""
|
"""Set up the scenes for Velux platform."""
|
||||||
entities = [VeluxScene(scene) for scene in hass.data[DATA_VELUX].pyvlx.scenes]
|
entities = [VeluxScene(scene) for scene in hass.data[DATA_VELUX].pyvlx.scenes]
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
|
@ -20,14 +20,19 @@ from homeassistant.components.remote import (
|
||||||
DEFAULT_DELAY_SECS,
|
DEFAULT_DELAY_SECS,
|
||||||
RemoteEntity,
|
RemoteEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import ConsoleData, XboxUpdateCoordinator
|
from . import ConsoleData, XboxUpdateCoordinator
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry, async_add_entities):
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
"""Set up Xbox media_player from a config entry."""
|
"""Set up Xbox media_player from a config entry."""
|
||||||
client: XboxLiveClient = hass.data[DOMAIN][entry.entry_id]["client"]
|
client: XboxLiveClient = hass.data[DOMAIN][entry.entry_id]["client"]
|
||||||
consoles: SmartglassConsoleList = hass.data[DOMAIN][entry.entry_id]["consoles"]
|
consoles: SmartglassConsoleList = hass.data[DOMAIN][entry.entry_id]["consoles"]
|
||||||
|
|
Loading…
Reference in New Issue