mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add setup type hints [l] (#63450)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
177b573454
commit
506a0b526b
@ -1,4 +1,6 @@
|
|||||||
"""Support for LaCrosse sensor components."""
|
"""Support for LaCrosse sensor components."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -22,10 +24,12 @@ from homeassistant.const import (
|
|||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import async_generate_entity_id
|
from homeassistant.helpers.entity import async_generate_entity_id
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -67,10 +71,15 @@ 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 LaCrosse sensors."""
|
"""Set up the LaCrosse sensors."""
|
||||||
usb_device = config.get(CONF_DEVICE)
|
usb_device = config[CONF_DEVICE]
|
||||||
baud = int(config.get(CONF_BAUD))
|
baud = int(config[CONF_BAUD])
|
||||||
expire_after = config.get(CONF_EXPIRE_AFTER)
|
expire_after = config.get(CONF_EXPIRE_AFTER)
|
||||||
|
|
||||||
_LOGGER.debug("%s %s", usb_device, baud)
|
_LOGGER.debug("%s %s", usb_device, baud)
|
||||||
@ -80,7 +89,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
lacrosse.open()
|
lacrosse.open()
|
||||||
except SerialException as exc:
|
except SerialException as exc:
|
||||||
_LOGGER.warning("Unable to open serial port: %s", exc)
|
_LOGGER.warning("Unable to open serial port: %s", exc)
|
||||||
return False
|
return
|
||||||
|
|
||||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, lambda event: lacrosse.close())
|
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, lambda event: lacrosse.close())
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Sensor for Last.fm account status."""
|
"""Sensor for Last.fm account status."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
@ -9,7 +11,10 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY
|
||||||
|
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__)
|
||||||
|
|
||||||
@ -32,10 +37,15 @@ 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 Last.fm sensor platform."""
|
"""Set up the Last.fm sensor platform."""
|
||||||
api_key = config[CONF_API_KEY]
|
api_key = config[CONF_API_KEY]
|
||||||
users = config.get(CONF_USERS)
|
users = config[CONF_USERS]
|
||||||
|
|
||||||
lastfm_api = lastfm.LastFMNetwork(api_key=api_key)
|
lastfm_api = lastfm.LastFMNetwork(api_key=api_key)
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for LG TV running on NetCast 3 or 4."""
|
"""Support for LG TV running on NetCast 3 or 4."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from pylgnetcast import LgNetCastClient, LgNetCastError
|
from pylgnetcast import LgNetCastClient, LgNetCastError
|
||||||
@ -28,8 +30,11 @@ from homeassistant.const import (
|
|||||||
STATE_PAUSED,
|
STATE_PAUSED,
|
||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
)
|
)
|
||||||
|
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.script import Script
|
from homeassistant.helpers.script import Script
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
@ -62,12 +67,17 @@ 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 LG TV platform."""
|
"""Set up the LG TV platform."""
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
access_token = config.get(CONF_ACCESS_TOKEN)
|
access_token = config.get(CONF_ACCESS_TOKEN)
|
||||||
name = config.get(CONF_NAME)
|
name = config[CONF_NAME]
|
||||||
on_action = config.get(CONF_ON_ACTION)
|
on_action = config.get(CONF_ON_ACTION)
|
||||||
|
|
||||||
client = LgNetCastClient(host, access_token)
|
client = LgNetCastClient(host, access_token)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for LimitlessLED bulbs."""
|
"""Support for LimitlessLED bulbs."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from limitlessled import Color
|
from limitlessled import Color
|
||||||
@ -31,8 +33,11 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_TYPE, STATE_ON
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_TYPE, STATE_ON
|
||||||
|
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.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util.color import color_hs_to_RGB, color_temperature_mired_to_kelvin
|
from homeassistant.util.color import color_hs_to_RGB, color_temperature_mired_to_kelvin
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -143,7 +148,12 @@ def rewrite_legacy(config):
|
|||||||
return {"bridges": new_bridges}
|
return {"bridges": new_bridges}
|
||||||
|
|
||||||
|
|
||||||
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 LimitlessLED lights."""
|
"""Set up the LimitlessLED lights."""
|
||||||
|
|
||||||
# Two legacy configuration formats are supported to maintain backwards
|
# Two legacy configuration formats are supported to maintain backwards
|
||||||
@ -152,7 +162,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
|
|
||||||
# Use the expanded configuration format.
|
# Use the expanded configuration format.
|
||||||
lights = []
|
lights = []
|
||||||
for bridge_conf in config.get(CONF_BRIDGES):
|
for bridge_conf in config[CONF_BRIDGES]:
|
||||||
bridge = Bridge(
|
bridge = Bridge(
|
||||||
bridge_conf.get(CONF_HOST),
|
bridge_conf.get(CONF_HOST),
|
||||||
port=bridge_conf.get(CONF_PORT, DEFAULT_PORT),
|
port=bridge_conf.get(CONF_PORT, DEFAULT_PORT),
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for monitoring the state of Linode Nodes."""
|
"""Support for monitoring the state of Linode Nodes."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -8,7 +10,10 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorDeviceClass,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
|
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 (
|
from . import (
|
||||||
ATTR_CREATED,
|
ATTR_CREATED,
|
||||||
@ -31,10 +36,15 @@ 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 Linode droplet sensor."""
|
"""Set up the Linode droplet sensor."""
|
||||||
linode = hass.data.get(DATA_LINODE)
|
linode = hass.data[DATA_LINODE]
|
||||||
nodes = config.get(CONF_NODES)
|
nodes = config[CONF_NODES]
|
||||||
|
|
||||||
dev = []
|
dev = []
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
"""Support for interacting with Linode nodes."""
|
"""Support for interacting with Linode nodes."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||||
|
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 (
|
from . import (
|
||||||
ATTR_CREATED,
|
ATTR_CREATED,
|
||||||
@ -28,10 +33,15 @@ 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 Linode Node switch."""
|
"""Set up the Linode Node switch."""
|
||||||
linode = hass.data.get(DATA_LINODE)
|
linode = hass.data[DATA_LINODE]
|
||||||
nodes = config.get(CONF_NODES)
|
nodes = config[CONF_NODES]
|
||||||
|
|
||||||
dev = []
|
dev = []
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
|
@ -5,6 +5,7 @@ import logging
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
ATTR_BATTERY_CHARGING,
|
ATTR_BATTERY_CHARGING,
|
||||||
@ -13,8 +14,11 @@ from homeassistant.const import (
|
|||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
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 homeassistant.helpers.icon import icon_for_battery_level
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util.dt import as_local
|
from homeassistant.util.dt import as_local
|
||||||
|
|
||||||
from .const import ATTRIBUTION, DEVICE_BRAND, DOMAIN as LOGI_CIRCLE_DOMAIN, SENSOR_TYPES
|
from .const import ATTRIBUTION, DEVICE_BRAND, DOMAIN as LOGI_CIRCLE_DOMAIN, SENSOR_TYPES
|
||||||
@ -22,17 +26,24 @@ from .const import ATTRIBUTION, DEVICE_BRAND, DOMAIN as LOGI_CIRCLE_DOMAIN, SENS
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
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 a sensor for a Logi Circle device. Obsolete."""
|
"""Set up a sensor for a Logi Circle device. Obsolete."""
|
||||||
_LOGGER.warning("Logi Circle no longer works with sensor platform configuration")
|
_LOGGER.warning("Logi Circle no longer works with sensor platform configuration")
|
||||||
|
|
||||||
|
|
||||||
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 a Logi Circle sensor based on a config entry."""
|
"""Set up a Logi Circle sensor based on a config entry."""
|
||||||
devices = await hass.data[LOGI_CIRCLE_DOMAIN].cameras
|
devices = await hass.data[LOGI_CIRCLE_DOMAIN].cameras
|
||||||
time_zone = str(hass.config.time_zone)
|
time_zone = str(hass.config.time_zone)
|
||||||
|
|
||||||
monitored_conditions = entry.data.get(CONF_SENSORS).get(CONF_MONITORED_CONDITIONS)
|
monitored_conditions = entry.data[CONF_SENSORS].get(CONF_MONITORED_CONDITIONS)
|
||||||
entities = [
|
entities = [
|
||||||
LogiSensor(device, time_zone, description)
|
LogiSensor(device, time_zone, description)
|
||||||
for description in SENSOR_TYPES
|
for description in SENSOR_TYPES
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Sensor for checking the status of London air."""
|
"""Sensor for checking the status of London air."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
@ -7,7 +9,10 @@ import requests
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
|
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 homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -60,12 +65,17 @@ 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 London Air sensor."""
|
"""Set up the London Air sensor."""
|
||||||
data = APIData()
|
data = APIData()
|
||||||
data.update()
|
data.update()
|
||||||
sensors = []
|
sensors = []
|
||||||
for name in config.get(CONF_LOCATIONS):
|
for name in config[CONF_LOCATIONS]:
|
||||||
sensors.append(AirSensor(name, data))
|
sensors.append(AirSensor(name, data))
|
||||||
|
|
||||||
add_entities(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Sensor for checking the status of London Underground tube lines."""
|
"""Sensor for checking the status of London Underground tube lines."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from london_tube_status import TubeData
|
from london_tube_status import TubeData
|
||||||
@ -6,7 +8,10 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION
|
from homeassistant.const import ATTR_ATTRIBUTION
|
||||||
|
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
|
||||||
|
|
||||||
ATTRIBUTION = "Powered by TfL Open Data"
|
ATTRIBUTION = "Powered by TfL Open Data"
|
||||||
|
|
||||||
@ -38,13 +43,18 @@ 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 Tube sensor."""
|
"""Set up the Tube sensor."""
|
||||||
|
|
||||||
data = TubeData()
|
data = TubeData()
|
||||||
data.update()
|
data.update()
|
||||||
sensors = []
|
sensors = []
|
||||||
for line in config.get(CONF_LINE):
|
for line in config[CONF_LINE]:
|
||||||
sensors.append(LondonTubeSensor(line, data))
|
sensors.append(LondonTubeSensor(line, data))
|
||||||
|
|
||||||
add_entities(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
@ -11,9 +11,11 @@ from homeassistant.const import (
|
|||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
Platform,
|
Platform,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
DOMAIN = "lutron"
|
DOMAIN = "lutron"
|
||||||
@ -50,7 +52,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, base_config):
|
def setup(hass: HomeAssistant, base_config: ConfigType) -> bool:
|
||||||
"""Set up the Lutron integration."""
|
"""Set up the Lutron integration."""
|
||||||
hass.data[LUTRON_BUTTONS] = []
|
hass.data[LUTRON_BUTTONS] = []
|
||||||
hass.data[LUTRON_CONTROLLER] = None
|
hass.data[LUTRON_CONTROLLER] = None
|
||||||
@ -62,7 +64,7 @@ def setup(hass, base_config):
|
|||||||
"binary_sensor": [],
|
"binary_sensor": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
config = base_config.get(DOMAIN)
|
config = base_config[DOMAIN]
|
||||||
hass.data[LUTRON_CONTROLLER] = Lutron(
|
hass.data[LUTRON_CONTROLLER] = Lutron(
|
||||||
config[CONF_HOST], config[CONF_USERNAME], config[CONF_PASSWORD]
|
config[CONF_HOST], config[CONF_USERNAME], config[CONF_PASSWORD]
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user