mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add light setup type hints [a-i] (#63291)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
acc974b26b
commit
7f9b7c7b0e
@ -1,4 +1,6 @@
|
|||||||
"""Support for the Elgato Avea lights."""
|
"""Support for the Elgato Avea lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import avea # pylint: disable=import-error
|
import avea # pylint: disable=import-error
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
@ -8,13 +10,21 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_COLOR,
|
SUPPORT_COLOR,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
SUPPORT_AVEA = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
SUPPORT_AVEA = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||||
|
|
||||||
|
|
||||||
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 Avea platform."""
|
"""Set up the Avea platform."""
|
||||||
try:
|
try:
|
||||||
nearby_bulbs = avea.discover_avea_bulbs()
|
nearby_bulbs = avea.discover_avea_bulbs()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Support for Axis lights."""
|
"""Support for Axis lights."""
|
||||||
|
|
||||||
from axis.event_stream import CLASS_LIGHT
|
from axis.event_stream import CLASS_LIGHT
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
@ -7,14 +6,20 @@ from homeassistant.components.light import (
|
|||||||
COLOR_MODE_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .axis_base import AxisEventBase
|
from .axis_base import AxisEventBase
|
||||||
from .const import DOMAIN as AXIS_DOMAIN
|
from .const import DOMAIN as AXIS_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 a Axis light."""
|
"""Set up a Axis light."""
|
||||||
device = hass.data[AXIS_DOMAIN][config_entry.unique_id]
|
device = hass.data[AXIS_DOMAIN][config_entry.unique_id]
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ from homeassistant.components.light import (
|
|||||||
COLOR_MODE_RGBW,
|
COLOR_MODE_RGBW,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.util.color import color_rgb_to_hex, rgb_hex_to_rgb_list
|
from homeassistant.util.color import color_rgb_to_hex, rgb_hex_to_rgb_list
|
||||||
|
|
||||||
from . import BleBoxEntity, create_blebox_entities
|
from . import BleBoxEntity, create_blebox_entities
|
||||||
@ -18,7 +21,11 @@ from . import BleBoxEntity, create_blebox_entities
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
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 a BleBox entry."""
|
"""Set up a BleBox entry."""
|
||||||
|
|
||||||
create_blebox_entities(
|
create_blebox_entities(
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Blinkstick lights."""
|
"""Support for Blinkstick lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from blinkstick import blinkstick
|
from blinkstick import blinkstick
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -11,7 +13,10 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
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
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
CONF_SERIAL = "serial"
|
CONF_SERIAL = "serial"
|
||||||
@ -28,7 +33,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:
|
||||||
"""Set up Blinkstick device specified by serial number."""
|
"""Set up Blinkstick device specified by serial number."""
|
||||||
|
|
||||||
name = config[CONF_NAME]
|
name = config[CONF_NAME]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Decora dimmers."""
|
"""Support for Decora dimmers."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
import logging
|
import logging
|
||||||
@ -16,7 +18,10 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
|
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
|
||||||
|
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
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -71,7 +76,12 @@ def retry(method):
|
|||||||
return wrapper_retry
|
return wrapper_retry
|
||||||
|
|
||||||
|
|
||||||
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 an Decora switch."""
|
"""Set up an Decora switch."""
|
||||||
lights = []
|
lights = []
|
||||||
for address, device_config in config[CONF_DEVICES].items():
|
for address, device_config in config[CONF_DEVICES].items():
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for EnOcean light sources."""
|
"""Support for EnOcean light sources."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -10,7 +12,10 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_ID, CONF_NAME
|
from homeassistant.const import CONF_ID, CONF_NAME
|
||||||
|
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 .device import EnOceanEntity
|
from .device import EnOceanEntity
|
||||||
|
|
||||||
@ -28,7 +33,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:
|
||||||
"""Set up the EnOcean light platform."""
|
"""Set up the EnOcean light platform."""
|
||||||
sender_id = config.get(CONF_SENDER_ID)
|
sender_id = config.get(CONF_SENDER_ID)
|
||||||
dev_name = config.get(CONF_NAME)
|
dev_name = config.get(CONF_NAME)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Eufy lights."""
|
"""Support for Eufy lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import lakeside
|
import lakeside
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
@ -10,6 +12,9 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_COLOR_TEMP,
|
SUPPORT_COLOR_TEMP,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
from homeassistant.util.color import (
|
from homeassistant.util.color import (
|
||||||
color_temperature_kelvin_to_mired as kelvin_to_mired,
|
color_temperature_kelvin_to_mired as kelvin_to_mired,
|
||||||
@ -20,7 +25,12 @@ EUFY_MAX_KELVIN = 6500
|
|||||||
EUFY_MIN_KELVIN = 2700
|
EUFY_MIN_KELVIN = 2700
|
||||||
|
|
||||||
|
|
||||||
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 Eufy bulbs."""
|
"""Set up Eufy bulbs."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -18,9 +18,12 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOSTS
|
from homeassistant.const import CONF_HOSTS
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
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
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -44,7 +47,12 @@ def color_int_to_rgb(value: int) -> tuple[int, int, int]:
|
|||||||
return (value >> 16, (value >> 8) & 0xFF, value & 0xFF)
|
return (value >> 16, (value >> 8) & 0xFF, value & 0xFF)
|
||||||
|
|
||||||
|
|
||||||
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 EverLights lights from configuration.yaml."""
|
"""Set up the EverLights lights from configuration.yaml."""
|
||||||
lights = []
|
lights = []
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Fibaro lights."""
|
"""Support for Fibaro lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
@ -13,6 +15,9 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_WHITE_VALUE
|
from homeassistant.const import CONF_WHITE_VALUE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from . import CONF_COLOR, CONF_DIMMING, CONF_RESET_COLOR, FIBARO_DEVICES, FibaroDevice
|
from . import CONF_COLOR, CONF_DIMMING, CONF_RESET_COLOR, FIBARO_DEVICES, FibaroDevice
|
||||||
@ -35,7 +40,12 @@ def scaleto100(value):
|
|||||||
return max(0, min(100, ((value * 100.0) / 255.0)))
|
return max(0, min(100, ((value * 100.0) / 255.0)))
|
||||||
|
|
||||||
|
|
||||||
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 controller devices."""
|
"""Perform the setup for Fibaro controller devices."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -11,16 +11,20 @@ from homeassistant.components.light import (
|
|||||||
COLOR_MODE_ONOFF,
|
COLOR_MODE_ONOFF,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
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 .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 Freedompro light."""
|
"""Set up Freedompro light."""
|
||||||
api_key = entry.data[CONF_API_KEY]
|
api_key = entry.data[CONF_API_KEY]
|
||||||
coordinator = hass.data[DOMAIN][entry.entry_id]
|
coordinator = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for FutureNow Ethernet unit outputs as Lights."""
|
"""Support for FutureNow Ethernet unit outputs as Lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import pyfnip
|
import pyfnip
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -9,7 +11,10 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_NAME, CONF_PORT
|
from homeassistant.const import CONF_DEVICES, CONF_HOST, CONF_NAME, CONF_PORT
|
||||||
|
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
|
||||||
|
|
||||||
CONF_DRIVER = "driver"
|
CONF_DRIVER = "driver"
|
||||||
CONF_DRIVER_FNIP6X10AD = "FNIP6x10ad"
|
CONF_DRIVER_FNIP6X10AD = "FNIP6x10ad"
|
||||||
@ -33,7 +38,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:
|
||||||
"""Set up the light platform for each FutureNow unit."""
|
"""Set up the light platform for each FutureNow unit."""
|
||||||
lights = []
|
lights = []
|
||||||
for channel, device_config in config[CONF_DEVICES].items():
|
for channel, device_config in config[CONF_DEVICES].items():
|
||||||
|
@ -10,7 +10,10 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_COLOR_TEMP,
|
SUPPORT_COLOR_TEMP,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
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
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from . import HiveEntity, refresh_system
|
from . import HiveEntity, refresh_system
|
||||||
@ -20,7 +23,9 @@ PARALLEL_UPDATES = 0
|
|||||||
SCAN_INTERVAL = timedelta(seconds=15)
|
SCAN_INTERVAL = timedelta(seconds=15)
|
||||||
|
|
||||||
|
|
||||||
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 Hive thermostat based on a config entry."""
|
"""Set up Hive thermostat based on a config entry."""
|
||||||
|
|
||||||
hive = hass.data[DOMAIN][entry.entry_id]
|
hive = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
@ -11,7 +11,10 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_COLOR,
|
SUPPORT_COLOR,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ENTITIES
|
from homeassistant.const import CONF_ENTITIES
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -30,7 +33,11 @@ from .entity import HomeConnectEntity
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
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 Home Connect light."""
|
"""Set up the Home Connect light."""
|
||||||
|
|
||||||
def get_entities():
|
def get_entities():
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Homematic lights."""
|
"""Support for Homematic lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP,
|
||||||
@ -12,6 +14,9 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import ATTR_DISCOVER_DEVICES
|
from .const import ATTR_DISCOVER_DEVICES
|
||||||
from .entity import HMDevice
|
from .entity import HMDevice
|
||||||
@ -19,7 +24,12 @@ from .entity import HMDevice
|
|||||||
SUPPORT_HOMEMATIC = SUPPORT_BRIGHTNESS
|
SUPPORT_HOMEMATIC = SUPPORT_BRIGHTNESS
|
||||||
|
|
||||||
|
|
||||||
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 Homematic light platform."""
|
"""Set up the Homematic light platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Lutron Homeworks lights."""
|
"""Support for Lutron Homeworks lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyhomeworks.pyhomeworks import HW_LIGHT_CHANGED
|
from pyhomeworks.pyhomeworks import HW_LIGHT_CHANGED
|
||||||
@ -9,15 +11,22 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import CONF_ADDR, CONF_DIMMERS, CONF_RATE, HOMEWORKS_CONTROLLER, HomeworksDevice
|
from . import CONF_ADDR, CONF_DIMMERS, CONF_RATE, HOMEWORKS_CONTROLLER, HomeworksDevice
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discover_info=None):
|
def setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
add_entities: AddEntitiesCallback,
|
||||||
|
discover_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up Homeworks lights."""
|
"""Set up Homeworks lights."""
|
||||||
if discover_info is None:
|
if discover_info is None:
|
||||||
return
|
return
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for lights under the iGlo brand."""
|
"""Support for lights under the iGlo brand."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from iglo import Lamp
|
from iglo import Lamp
|
||||||
@ -17,7 +19,10 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
||||||
|
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
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
DEFAULT_NAME = "iGlo Light"
|
DEFAULT_NAME = "iGlo Light"
|
||||||
@ -32,7 +37,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:
|
||||||
"""Set up the iGlo lights."""
|
"""Set up the iGlo lights."""
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
"""Support for IHC lights."""
|
"""Support for IHC lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
SUPPORT_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import IHC_CONTROLLER, IHC_INFO
|
from . import IHC_CONTROLLER, IHC_INFO
|
||||||
from .const import CONF_DIMMABLE, CONF_OFF_ID, CONF_ON_ID
|
from .const import CONF_DIMMABLE, CONF_OFF_ID, CONF_ON_ID
|
||||||
@ -11,7 +16,12 @@ from .ihcdevice import IHCDevice
|
|||||||
from .util import async_pulse, async_set_bool, async_set_int
|
from .util import async_pulse, async_set_bool, async_set_int
|
||||||
|
|
||||||
|
|
||||||
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 IHC lights platform."""
|
"""Set up the IHC lights platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Support for Insteon lights via PowerLinc Modem."""
|
"""Support for Insteon lights via PowerLinc Modem."""
|
||||||
|
|
||||||
from pyinsteon.extended_property import ON_LEVEL
|
from pyinsteon.extended_property import ON_LEVEL
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
@ -8,8 +7,10 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_BRIGHTNESS,
|
SUPPORT_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import SIGNAL_ADD_ENTITIES
|
from .const import SIGNAL_ADD_ENTITIES
|
||||||
from .insteon_entity import InsteonEntity
|
from .insteon_entity import InsteonEntity
|
||||||
@ -18,7 +19,11 @@ from .utils import async_add_insteon_entities
|
|||||||
MAX_BRIGHTNESS = 255
|
MAX_BRIGHTNESS = 255
|
||||||
|
|
||||||
|
|
||||||
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 Insteon lights from a config entry."""
|
"""Set up the Insteon lights from a config entry."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user