Add light setup type hints [s-z] (#63293)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
a46f25f2a9
commit
7967f49e48
18 changed files with 169 additions and 20 deletions
|
@ -4,6 +4,9 @@ import logging
|
||||||
from screenlogicpy.const import DATA as SL_DATA, GENERIC_CIRCUIT_NAMES
|
from screenlogicpy.const import DATA as SL_DATA, GENERIC_CIRCUIT_NAMES
|
||||||
|
|
||||||
from homeassistant.components.light import LightEntity
|
from homeassistant.components.light import LightEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import ScreenLogicCircuitEntity
|
from . import ScreenLogicCircuitEntity
|
||||||
from .const import DOMAIN, LIGHT_CIRCUIT_FUNCTIONS
|
from .const import DOMAIN, LIGHT_CIRCUIT_FUNCTIONS
|
||||||
|
@ -11,7 +14,11 @@ from .const import DOMAIN, LIGHT_CIRCUIT_FUNCTIONS
|
||||||
_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 entry."""
|
"""Set up entry."""
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for SCSGate lights."""
|
"""Support for SCSGate lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from scsgate.tasks import ToggleStatusTask
|
from scsgate.tasks import ToggleStatusTask
|
||||||
|
@ -6,7 +8,10 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.light import PLATFORM_SCHEMA, LightEntity
|
from homeassistant.components.light import PLATFORM_SCHEMA, LightEntity
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME
|
from homeassistant.const import ATTR_ENTITY_ID, ATTR_STATE, 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
|
||||||
|
|
||||||
from . import CONF_SCS_ID, DOMAIN, SCSGATE_SCHEMA
|
from . import CONF_SCS_ID, DOMAIN, SCSGATE_SCHEMA
|
||||||
|
|
||||||
|
@ -15,7 +20,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 SCSGate switches."""
|
"""Set up the SCSGate switches."""
|
||||||
devices = config.get(CONF_DEVICES)
|
devices = config.get(CONF_DEVICES)
|
||||||
lights = []
|
lights = []
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for Sense Hat LEDs."""
|
"""Support for Sense Hat LEDs."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from sense_hat import SenseHat
|
from sense_hat import SenseHat
|
||||||
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
|
||||||
|
|
||||||
SUPPORT_SENSEHAT = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
SUPPORT_SENSEHAT = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||||
|
@ -23,7 +28,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 Sense Hat Light platform."""
|
"""Set up the Sense Hat Light platform."""
|
||||||
|
|
||||||
sensehat = SenseHat()
|
sensehat = SenseHat()
|
||||||
|
|
|
@ -6,6 +6,9 @@ import pysmarthab
|
||||||
from requests.exceptions import Timeout
|
from requests.exceptions import Timeout
|
||||||
|
|
||||||
from homeassistant.components.light import LightEntity
|
from homeassistant.components.light import LightEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import DATA_HUB, DOMAIN
|
from . import DATA_HUB, DOMAIN
|
||||||
|
|
||||||
|
@ -14,7 +17,11 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
SCAN_INTERVAL = timedelta(seconds=60)
|
SCAN_INTERVAL = timedelta(seconds=60)
|
||||||
|
|
||||||
|
|
||||||
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 SmartHab lights from a config entry."""
|
"""Set up SmartHab lights from a config entry."""
|
||||||
hub = hass.data[DOMAIN][config_entry.entry_id][DATA_HUB]
|
hub = hass.data[DOMAIN][config_entry.entry_id][DATA_HUB]
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,20 @@ from homeassistant.components.light import (
|
||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
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 . import SmartThingsEntity
|
from . import SmartThingsEntity
|
||||||
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 lights for a config entry."""
|
"""Add lights 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(
|
async_add_entities(
|
||||||
|
|
|
@ -9,6 +9,9 @@ from homeassistant.components.light import (
|
||||||
SUPPORT_EFFECT,
|
SUPPORT_EFFECT,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_LIGHTS,
|
ATTR_LIGHTS,
|
||||||
|
@ -21,7 +24,9 @@ from .entity import SmartTubEntity
|
||||||
from .helpers import get_spa_name
|
from .helpers import get_spa_name
|
||||||
|
|
||||||
|
|
||||||
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 entities for any lights in the tub."""
|
"""Set up entities for any lights in the tub."""
|
||||||
|
|
||||||
controller = hass.data[DOMAIN][entry.entry_id][SMARTTUB_CONTROLLER]
|
controller = hass.data[DOMAIN][entry.entry_id][SMARTTUB_CONTROLLER]
|
||||||
|
|
|
@ -7,14 +7,21 @@ from homeassistant.components.light import (
|
||||||
SUPPORT_BRIGHTNESS,
|
SUPPORT_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .entry import TelldusLiveEntity
|
from .entry import TelldusLiveEntity
|
||||||
|
|
||||||
_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 tellduslive sensors dynamically."""
|
"""Set up tellduslive sensors dynamically."""
|
||||||
|
|
||||||
async def async_discover_light(device_id):
|
async def async_discover_light(device_id):
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
"""Support for Tellstick lights."""
|
"""Support for Tellstick 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 (
|
from . import (
|
||||||
ATTR_DISCOVER_CONFIG,
|
ATTR_DISCOVER_CONFIG,
|
||||||
|
@ -16,7 +21,12 @@ from . import (
|
||||||
SUPPORT_TELLSTICK = SUPPORT_BRIGHTNESS
|
SUPPORT_TELLSTICK = 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 Tellstick lights."""
|
"""Set up the Tellstick lights."""
|
||||||
if discovery_info is None or discovery_info[ATTR_DISCOVER_DEVICES] is None:
|
if discovery_info is None or discovery_info[ATTR_DISCOVER_DEVICES] is None:
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for Tikteck lights."""
|
"""Support for Tikteck lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import tikteck
|
import tikteck
|
||||||
|
@ -13,7 +15,10 @@ from homeassistant.components.light import (
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PASSWORD
|
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PASSWORD
|
||||||
|
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
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -29,7 +34,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 Tikteck platform."""
|
"""Set up the Tikteck platform."""
|
||||||
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 Unifi Led lights."""
|
"""Support for Unifi Led lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from unifiled import unifiled
|
from unifiled import unifiled
|
||||||
|
@ -11,7 +13,10 @@ from homeassistant.components.light import (
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||||
|
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__)
|
||||||
|
|
||||||
|
@ -26,7 +31,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 Unifi LED platform."""
|
"""Set up the Unifi LED platform."""
|
||||||
|
|
||||||
# Assign configuration variables.
|
# Assign configuration variables.
|
||||||
|
|
|
@ -8,7 +8,10 @@ from homeassistant.components.light import (
|
||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
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 UpbAttachedEntity
|
from . import UpbAttachedEntity
|
||||||
from .const import DOMAIN, UPB_BLINK_RATE_SCHEMA, UPB_BRIGHTNESS_RATE_SCHEMA
|
from .const import DOMAIN, UPB_BLINK_RATE_SCHEMA, UPB_BRIGHTNESS_RATE_SCHEMA
|
||||||
|
@ -18,7 +21,11 @@ SERVICE_LIGHT_FADE_STOP = "light_fade_stop"
|
||||||
SERVICE_LIGHT_BLINK = "light_blink"
|
SERVICE_LIGHT_BLINK = "light_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 light based on a config entry."""
|
"""Set up the UPB light based on a config entry."""
|
||||||
|
|
||||||
upb = hass.data[DOMAIN][config_entry.entry_id]["upb"]
|
upb = hass.data[DOMAIN][config_entry.entry_id]["upb"]
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for Velux lights."""
|
"""Support for Velux lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from pyvlx import Intensity, LighteningDevice
|
from pyvlx import Intensity, LighteningDevice
|
||||||
from pyvlx.node import Node
|
from pyvlx.node import Node
|
||||||
|
|
||||||
|
@ -7,11 +9,19 @@ from homeassistant.components.light import (
|
||||||
COLOR_MODE_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import DATA_VELUX, VeluxEntity
|
from . import DATA_VELUX, VeluxEntity
|
||||||
|
|
||||||
|
|
||||||
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 light(s) for Velux platform."""
|
"""Set up light(s) for Velux platform."""
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
VeluxLight(node)
|
VeluxLight(node)
|
||||||
|
|
|
@ -8,8 +8,10 @@ from homeassistant.components.light import (
|
||||||
COLOR_MODE_COLOR_TEMP,
|
COLOR_MODE_COLOR_TEMP,
|
||||||
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 .common import VeSyncDevice
|
from .common import VeSyncDevice
|
||||||
from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS_LIGHTS
|
from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS_LIGHTS
|
||||||
|
@ -24,7 +26,11 @@ DEV_TYPE_TO_HA = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 lights."""
|
"""Set up lights."""
|
||||||
|
|
||||||
async def async_discover(devices):
|
async def async_discover(devices):
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for X10 lights."""
|
"""Support for X10 lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from subprocess import STDOUT, CalledProcessError, check_output
|
from subprocess import STDOUT, CalledProcessError, check_output
|
||||||
|
|
||||||
|
@ -11,7 +13,10 @@ from homeassistant.components.light import (
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICES, CONF_ID, CONF_NAME
|
from homeassistant.const import CONF_DEVICES, 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
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -38,7 +43,12 @@ def get_unit_status(code):
|
||||||
return int(output.decode("utf-8")[0])
|
return int(output.decode("utf-8")[0])
|
||||||
|
|
||||||
|
|
||||||
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 x10 Light platform."""
|
"""Set up the x10 Light platform."""
|
||||||
is_cm11a = True
|
is_cm11a = True
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
"""Support for XBee Zigbee lights."""
|
"""Support for XBee Zigbee lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.light import LightEntity
|
from homeassistant.components.light import LightEntity
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import PLATFORM_SCHEMA, XBeeDigitalOut, XBeeDigitalOutConfig
|
from . import PLATFORM_SCHEMA, XBeeDigitalOut, XBeeDigitalOutConfig
|
||||||
from .const import CONF_ON_STATE, DEFAULT_ON_STATE, DOMAIN, STATES
|
from .const import CONF_ON_STATE, DEFAULT_ON_STATE, DOMAIN, STATES
|
||||||
|
@ -11,7 +16,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:
|
||||||
"""Create and add an entity based on the configuration."""
|
"""Create and add an entity based on the configuration."""
|
||||||
zigbee_device = hass.data[DOMAIN]
|
zigbee_device = hass.data[DOMAIN]
|
||||||
add_entities([XBeeLight(XBeeDigitalOutConfig(config), zigbee_device)])
|
add_entities([XBeeLight(XBeeDigitalOutConfig(config), zigbee_device)])
|
||||||
|
|
|
@ -10,6 +10,9 @@ from homeassistant.components.light import (
|
||||||
SUPPORT_COLOR,
|
SUPPORT_COLOR,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
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 . import XiaomiDevice
|
from . import XiaomiDevice
|
||||||
|
@ -18,7 +21,11 @@ from .const import DOMAIN, GATEWAYS_KEY
|
||||||
_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:
|
||||||
"""Perform the setup for Xiaomi devices."""
|
"""Perform the setup for Xiaomi devices."""
|
||||||
entities = []
|
entities = []
|
||||||
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
|
gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id]
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for Zengge lights."""
|
"""Support for Zengge lights."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -15,7 +17,10 @@ from homeassistant.components.light import (
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICES, CONF_NAME
|
from homeassistant.const import 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
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -29,7 +34,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 Zengge platform."""
|
"""Set up the Zengge platform."""
|
||||||
lights = []
|
lights = []
|
||||||
for address, device_config in config[CONF_DEVICES].items():
|
for address, device_config in config[CONF_DEVICES].items():
|
||||||
|
|
|
@ -16,9 +16,11 @@ from homeassistant.components.light import (
|
||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
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 . import CONF_REFRESH_DELAY, CONF_REFRESH_VALUE, ZWaveDeviceEntity, const
|
from . import CONF_REFRESH_DELAY, CONF_REFRESH_VALUE, ZWaveDeviceEntity, const
|
||||||
|
|
||||||
|
@ -60,7 +62,11 @@ TEMP_WARM_HASS = (TEMP_COLOR_MAX - TEMP_COLOR_MIN) / 3 * 2 + TEMP_COLOR_MIN
|
||||||
TEMP_COLD_HASS = (TEMP_COLOR_MAX - TEMP_COLOR_MIN) / 3 + TEMP_COLOR_MIN
|
TEMP_COLD_HASS = (TEMP_COLOR_MAX - TEMP_COLOR_MIN) / 3 + TEMP_COLOR_MIN
|
||||||
|
|
||||||
|
|
||||||
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 Z-Wave Light from Config Entry."""
|
"""Set up Z-Wave Light from Config Entry."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue