Use platform enum (7) [T-Z] (#60948)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
73c880b6c2
commit
b79b35abb5
45 changed files with 200 additions and 136 deletions
|
@ -9,7 +9,7 @@ import requests.exceptions
|
|||
|
||||
from homeassistant.components.climate.const import PRESET_AWAY, PRESET_HOME
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
@ -31,7 +31,12 @@ from .const import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
PLATFORMS = ["binary_sensor", "sensor", "climate", "water_heater"]
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CLIMATE,
|
||||
Platform.SENSOR,
|
||||
Platform.WATER_HEATER,
|
||||
]
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=4)
|
||||
SCAN_INTERVAL = timedelta(minutes=5)
|
||||
|
|
|
@ -3,9 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from tailscale import Device as TailscaleDevice
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
|
||||
|
@ -17,7 +16,7 @@ from homeassistant.helpers.update_coordinator import (
|
|||
from .const import DOMAIN
|
||||
from .coordinator import TailscaleDataUpdateCoordinator
|
||||
|
||||
PLATFORMS = (BINARY_SENSOR_DOMAIN, SENSOR_DOMAIN)
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -15,7 +15,7 @@ from tesla_wall_connector.exceptions import (
|
|||
)
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_SCAN_INTERVAL
|
||||
from homeassistant.const import CONF_HOST, CONF_SCAN_INTERVAL, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -34,7 +34,7 @@ from .const import (
|
|||
WALLCONNECTOR_DEVICE_NAME,
|
||||
)
|
||||
|
||||
PLATFORMS: list[str] = ["binary_sensor", "sensor"]
|
||||
PLATFORMS: list[Platform] = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -5,7 +5,12 @@ import logging
|
|||
import aiohttp
|
||||
import tibber
|
||||
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.const import (
|
||||
CONF_ACCESS_TOKEN,
|
||||
CONF_NAME,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -14,9 +19,7 @@ from homeassistant.util import dt as dt_util
|
|||
|
||||
from .const import DATA_HASS_CONFIG, DOMAIN
|
||||
|
||||
PLATFORMS = [
|
||||
"sensor",
|
||||
]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
||||
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from pytile.errors import InvalidAuthError, SessionExpiredError, TileError
|
|||
from pytile.tile import Tile
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import aiohttp_client
|
||||
|
@ -19,7 +19,7 @@ from homeassistant.util.async_ import gather_with_concurrency
|
|||
|
||||
from .const import DATA_COORDINATOR, DATA_TILE, DOMAIN, LOGGER
|
||||
|
||||
PLATFORMS = ["device_tracker"]
|
||||
PLATFORMS = [Platform.DEVICE_TRACKER]
|
||||
DEVICE_TYPES = ["PHONE", "TILE"]
|
||||
|
||||
DEFAULT_INIT_TASK_LIMIT = 2
|
||||
|
|
|
@ -11,7 +11,7 @@ from tololib.errors import ResponseTimedOutError
|
|||
from tololib.message_info import SettingsInfo, StatusInfo
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.const import CONF_HOST, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
|
@ -23,13 +23,13 @@ from homeassistant.helpers.update_coordinator import (
|
|||
from .const import DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT, DOMAIN
|
||||
|
||||
PLATFORMS = [
|
||||
"binary_sensor",
|
||||
"button",
|
||||
"climate",
|
||||
"fan",
|
||||
"light",
|
||||
"select",
|
||||
"sensor",
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.BUTTON,
|
||||
Platform.CLIMATE,
|
||||
Platform.FAN,
|
||||
Platform.LIGHT,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -2,16 +2,13 @@
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_CLIENT_ID,
|
||||
CONF_CLIENT_SECRET,
|
||||
CONF_SCAN_INTERVAL,
|
||||
EVENT_HOMEASSISTANT_STARTED,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import CoreState, HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||
|
@ -25,12 +22,12 @@ from .const import CONF_AGREEMENT_ID, CONF_MIGRATE, DEFAULT_SCAN_INTERVAL, DOMAI
|
|||
from .coordinator import ToonDataUpdateCoordinator
|
||||
from .oauth2 import register_oauth2_implementations
|
||||
|
||||
PLATFORMS = {
|
||||
BINARY_SENSOR_DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SENSOR_DOMAIN,
|
||||
SWITCH_DOMAIN,
|
||||
}
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CLIMATE,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
# Validation of the user's configuration
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
|
|
|
@ -7,7 +7,7 @@ from total_connect_client.client import TotalConnectClient
|
|||
from total_connect_client.exceptions import AuthenticationError, TotalConnectError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, Upda
|
|||
|
||||
from .const import CONF_USERCODES, DOMAIN
|
||||
|
||||
PLATFORMS = ["alarm_control_panel", "binary_sensor"]
|
||||
PLATFORMS = [Platform.ALARM_CONTROL_PANEL, Platform.BINARY_SENSOR]
|
||||
|
||||
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
||||
SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
|
|
@ -3,6 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Final
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "tplink"
|
||||
|
||||
ATTR_CURRENT_A: Final = "current_a"
|
||||
|
@ -17,4 +19,4 @@ CONF_STRIP: Final = "strip"
|
|||
CONF_SWITCH: Final = "switch"
|
||||
CONF_SENSOR: Final = "sensor"
|
||||
|
||||
PLATFORMS: Final = [CONF_LIGHT, CONF_SENSOR, CONF_SWITCH]
|
||||
PLATFORMS: Final = [Platform.LIGHT, Platform.SENSOR, Platform.SWITCH]
|
||||
|
|
|
@ -4,8 +4,7 @@ from http import HTTPStatus
|
|||
from aiohttp import web
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
|
||||
from homeassistant.const import ATTR_ID, CONF_WEBHOOK_ID
|
||||
from homeassistant.const import ATTR_ID, CONF_WEBHOOK_ID, Platform
|
||||
from homeassistant.helpers import config_entry_flow
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
|
@ -22,7 +21,7 @@ from .const import (
|
|||
DOMAIN,
|
||||
)
|
||||
|
||||
PLATFORMS = [DEVICE_TRACKER]
|
||||
PLATFORMS = [Platform.DEVICE_TRACKER]
|
||||
|
||||
|
||||
TRACKER_UPDATE = f"{DOMAIN}_tracker_update"
|
||||
|
|
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||
CONF_EMAIL,
|
||||
CONF_PASSWORD,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import Event, HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
|
@ -38,7 +39,12 @@ from .const import (
|
|||
TRACKER_POSITION_UPDATED,
|
||||
)
|
||||
|
||||
PLATFORMS = ["binary_sensor", "device_tracker", "sensor", "switch"]
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.DEVICE_TRACKER,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
"""Consts used by Tradfri."""
|
||||
from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_TRANSITION
|
||||
from homeassistant.const import CONF_HOST # noqa: F401 pylint: disable=unused-import
|
||||
from homeassistant.const import ( # noqa: F401 pylint: disable=unused-import
|
||||
CONF_HOST,
|
||||
Platform,
|
||||
)
|
||||
|
||||
ATTR_AUTO = "Auto"
|
||||
ATTR_DIMMER = "dimmer"
|
||||
|
@ -25,5 +28,11 @@ SIGNAL_GW = "tradfri.gw_status"
|
|||
KEY_SECURITY_CODE = "security_code"
|
||||
SUPPORTED_GROUP_FEATURES = SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
|
||||
SUPPORTED_LIGHT_FEATURES = SUPPORT_TRANSITION
|
||||
PLATFORMS = ["cover", "fan", "light", "sensor", "switch"]
|
||||
PLATFORMS = [
|
||||
Platform.COVER,
|
||||
Platform.FAN,
|
||||
Platform.LIGHT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
TIMEOUT_API = 30
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
"""Adds constants for Trafikverket Weather integration."""
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "trafikverket_weatherstation"
|
||||
CONF_STATION = "station"
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
ATTRIBUTION = "Data provided by Trafikverket"
|
||||
ATTR_MEASURE_TIME = "measure_time"
|
||||
ATTR_ACTIVE = "active"
|
||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
|||
CONF_PORT,
|
||||
CONF_SCAN_INTERVAL,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
@ -95,7 +96,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLATFORMS = ["sensor", "switch"]
|
||||
PLATFORMS = [Platform.SENSOR, Platform.SWITCH]
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
|
|
|
@ -35,6 +35,7 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
VOLUME_CUBIC_FEET,
|
||||
VOLUME_CUBIC_METERS,
|
||||
Platform,
|
||||
)
|
||||
|
||||
DOMAIN = "tuya"
|
||||
|
@ -77,21 +78,21 @@ TUYA_SMART_APP = "tuyaSmart"
|
|||
SMARTLIFE_APP = "smartlife"
|
||||
|
||||
PLATFORMS = [
|
||||
"binary_sensor",
|
||||
"button",
|
||||
"camera",
|
||||
"climate",
|
||||
"cover",
|
||||
"fan",
|
||||
"humidifier",
|
||||
"light",
|
||||
"number",
|
||||
"scene",
|
||||
"select",
|
||||
"sensor",
|
||||
"siren",
|
||||
"switch",
|
||||
"vacuum",
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.BUTTON,
|
||||
Platform.CAMERA,
|
||||
Platform.CLIMATE,
|
||||
Platform.COVER,
|
||||
Platform.FAN,
|
||||
Platform.HUMIDIFIER,
|
||||
Platform.LIGHT,
|
||||
Platform.NUMBER,
|
||||
Platform.SCENE,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
Platform.SIREN,
|
||||
Platform.SWITCH,
|
||||
Platform.VACUUM,
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from twentemilieu import TwenteMilieu, WasteType
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ID
|
||||
from homeassistant.const import CONF_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -20,7 +20,7 @@ SCAN_INTERVAL = timedelta(seconds=3600)
|
|||
SERVICE_UPDATE = "update"
|
||||
SERVICE_SCHEMA = vol.Schema({vol.Optional(CONF_ID): cv.string})
|
||||
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
import twinkly_client
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import CONF_ENTRY_HOST, CONF_ENTRY_ID, DOMAIN
|
||||
|
||||
PLATFORMS = ["light"]
|
||||
PLATFORMS = [Platform.LIGHT]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -26,9 +26,6 @@ from aiounifi.events import (
|
|||
from aiounifi.websocket import STATE_DISCONNECTED, STATE_RUNNING
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.components.unifi.switch import BLOCK_SWITCH, POE_SWITCH
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
|
@ -36,6 +33,7 @@ from homeassistant.const import (
|
|||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
|
@ -75,7 +73,7 @@ from .errors import AuthenticationRequired, CannotConnect
|
|||
|
||||
RETRY_TIMER = 15
|
||||
CHECK_HEARTBEAT_INTERVAL = timedelta(seconds=1)
|
||||
PLATFORMS = [TRACKER_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN]
|
||||
PLATFORMS = [Platform.DEVICE_TRACKER, Platform.SENSOR, Platform.SWITCH]
|
||||
|
||||
CLIENT_CONNECTED = (
|
||||
WIRED_CLIENT_CONNECTED,
|
||||
|
@ -337,9 +335,9 @@ class UniFiController:
|
|||
for entry in async_entries_for_config_entry(
|
||||
entity_registry, self.config_entry.entry_id
|
||||
):
|
||||
if entry.domain == TRACKER_DOMAIN:
|
||||
if entry.domain == Platform.DEVICE_TRACKER:
|
||||
mac = entry.unique_id.split("-", 1)[0]
|
||||
elif entry.domain == SWITCH_DOMAIN and (
|
||||
elif entry.domain == Platform.SWITCH and (
|
||||
entry.unique_id.startswith(BLOCK_SWITCH)
|
||||
or entry.unique_id.startswith(POE_SWITCH)
|
||||
):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import upb_lib
|
||||
|
||||
from homeassistant.const import ATTR_COMMAND, CONF_FILE_PATH, CONF_HOST
|
||||
from homeassistant.const import ATTR_COMMAND, CONF_FILE_PATH, CONF_HOST, Platform
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
|
@ -14,7 +14,7 @@ from .const import (
|
|||
EVENT_UPB_SCENE_CHANGED,
|
||||
)
|
||||
|
||||
PLATFORMS = ["light", "scene"]
|
||||
PLATFORMS = [Platform.LIGHT, Platform.SCENE]
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
|
|
|
@ -9,8 +9,6 @@ from typing import Any, Dict
|
|||
import requests.exceptions
|
||||
import upcloud_api
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_PASSWORD,
|
||||
|
@ -19,6 +17,7 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
STATE_PROBLEM,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
@ -48,7 +47,7 @@ DATA_UPCLOUD = "data_upcloud"
|
|||
|
||||
DEFAULT_COMPONENT_NAME = "UpCloud {}"
|
||||
|
||||
CONFIG_ENTRY_DOMAINS = {BINARY_SENSOR_DOMAIN, SWITCH_DOMAIN}
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SWITCH]
|
||||
|
||||
SIGNAL_UPDATE_UPCLOUD = "upcloud_update"
|
||||
|
||||
|
@ -157,7 +156,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
hass.data[DATA_UPCLOUD].coordinators[entry.data[CONF_USERNAME]] = coordinator
|
||||
|
||||
# Forward entry setup
|
||||
hass.config_entries.async_setup_platforms(entry, CONFIG_ENTRY_DOMAINS)
|
||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -165,7 +164,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Unload the config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(
|
||||
config_entry, CONFIG_ENTRY_DOMAINS
|
||||
config_entry, PLATFORMS
|
||||
)
|
||||
|
||||
hass.data[DATA_UPCLOUD].coordinators.pop(config_entry.data[CONF_USERNAME])
|
||||
|
|
|
@ -16,6 +16,7 @@ from homeassistant.components import ssdp
|
|||
from homeassistant.components.binary_sensor import BinarySensorEntityDescription
|
||||
from homeassistant.components.sensor import SensorEntityDescription
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
@ -43,7 +44,7 @@ from .device import Device
|
|||
NOTIFICATION_ID = "upnp_notification"
|
||||
NOTIFICATION_TITLE = "UPnP/IGD Setup"
|
||||
|
||||
PLATFORMS = ["binary_sensor", "sensor"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
vol.All(
|
||||
|
|
|
@ -5,13 +5,15 @@ from datetime import timedelta
|
|||
from logging import Logger, getLogger
|
||||
from typing import Final
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
LOGGER: Logger = getLogger(__package__)
|
||||
|
||||
# The free plan is limited to 10 requests/minute
|
||||
COORDINATOR_UPDATE_INTERVAL: timedelta = timedelta(seconds=10)
|
||||
|
||||
DOMAIN: Final = "uptimerobot"
|
||||
PLATFORMS: Final = ["binary_sensor"]
|
||||
PLATFORMS: Final = [Platform.BINARY_SENSOR]
|
||||
|
||||
ATTRIBUTION: Final = "Data provided by UptimeRobot"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from velbusaio.controller import Velbus
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_PORT
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_PORT, Platform
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import device_registry
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -26,7 +26,14 @@ from .const import (
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = ["switch", "sensor", "binary_sensor", "cover", "climate", "light"]
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CLIMATE,
|
||||
Platform.COVER,
|
||||
Platform.LIGHT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
|
||||
async def velbus_connect_task(
|
||||
|
|
|
@ -12,6 +12,7 @@ from homeassistant.const import (
|
|||
CONF_PIN,
|
||||
CONF_SSL,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import update_coordinator
|
||||
|
@ -19,7 +20,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|||
|
||||
from .const import _LOGGER, DOMAIN, VENSTAR_TIMEOUT
|
||||
|
||||
PLATFORMS = ["binary_sensor", "climate", "sensor"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.CLIMATE, Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config):
|
||||
|
|
|
@ -4,16 +4,8 @@ from __future__ import annotations
|
|||
from contextlib import suppress
|
||||
import os
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN as ALARM_CONTROL_PANEL_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
|
||||
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -23,12 +15,12 @@ from .const import DOMAIN
|
|||
from .coordinator import VerisureDataUpdateCoordinator
|
||||
|
||||
PLATFORMS = [
|
||||
ALARM_CONTROL_PANEL_DOMAIN,
|
||||
BINARY_SENSOR_DOMAIN,
|
||||
CAMERA_DOMAIN,
|
||||
LOCK_DOMAIN,
|
||||
SENSOR_DOMAIN,
|
||||
SWITCH_DOMAIN,
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CAMERA,
|
||||
Platform.LOCK,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
|
||||
|
|
|
@ -6,11 +6,17 @@ from homeassistant.const import (
|
|||
DEVICE_CLASS_GAS,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
VOLUME_CUBIC_METERS,
|
||||
Platform,
|
||||
)
|
||||
|
||||
DOMAIN = "vicare"
|
||||
|
||||
PLATFORMS = ["climate", "sensor", "binary_sensor", "water_heater"]
|
||||
PLATFORMS = [
|
||||
Platform.CLIMATE,
|
||||
Platform.SENSOR,
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.WATER_HEATER,
|
||||
]
|
||||
|
||||
VICARE_DEVICE_CONFIG = "device_conf"
|
||||
VICARE_API = "api"
|
||||
|
|
|
@ -6,14 +6,14 @@ from vilfo import Client as VilfoClient
|
|||
from vilfo.exceptions import VilfoException
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from .const import ATTR_BOOT_TIME, ATTR_LOAD, DOMAIN, ROUTER_DEFAULT_HOST
|
||||
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
||||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.media_player import DEVICE_CLASS_TV
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry, ConfigEntryState
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -40,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLATFORMS = ["media_player"]
|
||||
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
|
|
@ -3,13 +3,13 @@ from aiovlc.client import Client
|
|||
from aiovlc.exceptions import AuthError, ConnectError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
|
||||
from .const import DATA_AVAILABLE, DATA_VLC, DOMAIN, LOGGER
|
||||
|
||||
PLATFORMS = ["media_player"]
|
||||
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
from pyvolumio import CannotConnectError, Volumio
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import DATA_INFO, DATA_VOLUMIO, DOMAIN
|
||||
|
||||
PLATFORMS = ["media_player"]
|
||||
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -10,7 +10,7 @@ import requests
|
|||
from wallbox import Wallbox
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, HomeAssistantError
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
@ -19,7 +19,7 @@ from .const import CONF_DATA_KEY, CONF_MAX_CHARGING_CURRENT_KEY, CONF_STATION, D
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = ["sensor", "number"]
|
||||
PLATFORMS = [Platform.SENSOR, Platform.NUMBER]
|
||||
UPDATE_INTERVAL = 30
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||
CONF_LONGITUDE,
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
|
@ -23,7 +24,7 @@ from .const import DOMAIN, LOGGER
|
|||
|
||||
DEFAULT_UPDATE_INTERVAL = timedelta(minutes=5)
|
||||
|
||||
PLATFORMS: list[str] = ["sensor"]
|
||||
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
"""The waze_travel_time component."""
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_registry import (
|
||||
async_entries_for_config_entry,
|
||||
async_get,
|
||||
)
|
||||
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -5,6 +5,7 @@ import aiohttp
|
|||
from whirlpool.auth import Auth
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
||||
|
@ -12,7 +13,7 @@ from .const import AUTH_INSTANCE_KEY, DOMAIN
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = ["climate"]
|
||||
PLATFORMS = [Platform.CLIMATE]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
|||
from wiffi import WiffiTcpServer
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PORT, CONF_TIMEOUT
|
||||
from homeassistant.const import CONF_PORT, CONF_TIMEOUT, Platform
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import device_registry
|
||||
|
@ -29,7 +29,7 @@ from .const import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
PLATFORMS = ["sensor", "binary_sensor"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""The WiLight integration."""
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
@ -10,7 +11,7 @@ from .parent_device import WiLightParent
|
|||
DOMAIN = "wilight"
|
||||
|
||||
# List the platforms that you want to support.
|
||||
PLATFORMS = ["cover", "fan", "light"]
|
||||
PLATFORMS = [Platform.COVER, Platform.FAN, Platform.LIGHT]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -7,7 +7,7 @@ from wolf_smartset.token_auth import InvalidAuth
|
|||
from wolf_smartset.wolf_client import FetchFailed, ParameterReadError, WolfClient
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
@ -23,7 +23,7 @@ from .const import (
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -21,7 +21,7 @@ from xbox.webapi.api.provider.smartglass.models import (
|
|||
)
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
|
||||
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import (
|
||||
aiohttp_client,
|
||||
|
@ -48,7 +48,12 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLATFORMS = ["media_player", "remote", "binary_sensor", "sensor"]
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.MEDIA_PLAYER,
|
||||
Platform.REMOTE,
|
||||
Platform.SENSOR,
|
||||
]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
|
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||
CONF_PORT,
|
||||
CONF_PROTOCOL,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
@ -36,8 +37,15 @@ from .const import (
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
GATEWAY_PLATFORMS = ["binary_sensor", "sensor", "switch", "light", "cover", "lock"]
|
||||
GATEWAY_PLATFORMS_NO_KEY = ["binary_sensor", "sensor"]
|
||||
GATEWAY_PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.COVER,
|
||||
Platform.LIGHT,
|
||||
Platform.LOCK,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
GATEWAY_PLATFORMS_NO_KEY = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
ATTR_GW_MAC = "gw_mac"
|
||||
ATTR_RINGTONE_ID = "ringtone_id"
|
||||
|
|
|
@ -33,7 +33,7 @@ from miio import (
|
|||
from miio.gateway.gateway import GatewayException
|
||||
|
||||
from homeassistant import config_entries, core
|
||||
from homeassistant.const import CONF_HOST, CONF_TOKEN
|
||||
from homeassistant.const import CONF_HOST, CONF_TOKEN, Platform
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
@ -78,20 +78,32 @@ _LOGGER = logging.getLogger(__name__)
|
|||
POLLING_TIMEOUT_SEC = 10
|
||||
UPDATE_INTERVAL = timedelta(seconds=15)
|
||||
|
||||
GATEWAY_PLATFORMS = ["alarm_control_panel", "light", "sensor", "switch"]
|
||||
SWITCH_PLATFORMS = ["switch"]
|
||||
FAN_PLATFORMS = ["binary_sensor", "fan", "number", "select", "sensor", "switch"]
|
||||
HUMIDIFIER_PLATFORMS = [
|
||||
"binary_sensor",
|
||||
"humidifier",
|
||||
"number",
|
||||
"select",
|
||||
"sensor",
|
||||
"switch",
|
||||
GATEWAY_PLATFORMS = [
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.LIGHT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
LIGHT_PLATFORMS = ["light"]
|
||||
VACUUM_PLATFORMS = ["binary_sensor", "sensor", "vacuum"]
|
||||
AIR_MONITOR_PLATFORMS = ["air_quality", "sensor"]
|
||||
SWITCH_PLATFORMS = [Platform.SWITCH]
|
||||
FAN_PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.FAN,
|
||||
Platform.NUMBER,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
HUMIDIFIER_PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.HUMIDIFIER,
|
||||
Platform.NUMBER,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
LIGHT_PLATFORMS = [Platform.LIGHT]
|
||||
VACUUM_PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR, Platform.VACUUM]
|
||||
AIR_MONITOR_PLATFORMS = [Platform.AIR_QUALITY, Platform.SENSOR]
|
||||
|
||||
MODEL_TO_CLASS_MAP = {
|
||||
MODEL_FAN_1C: Fan1C,
|
||||
|
|
|
@ -11,6 +11,7 @@ from homeassistant.const import (
|
|||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
STATE_ALARM_DISARMED,
|
||||
Platform,
|
||||
)
|
||||
|
||||
CONF_AREA_ID = "area_id"
|
||||
|
@ -30,7 +31,7 @@ LOGGER = logging.getLogger(__package__)
|
|||
ATTR_ONLINE = "online"
|
||||
ATTR_STATUS = "status"
|
||||
|
||||
PLATFORMS = ["alarm_control_panel"]
|
||||
PLATFORMS = [Platform.ALARM_CONTROL_PANEL]
|
||||
|
||||
STATE_MAP = {
|
||||
YALE_STATE_DISARM: STATE_ALARM_DISARMED,
|
||||
|
|
|
@ -10,7 +10,7 @@ from aiomusiccast.musiccast_device import MusicCastData, MusicCastDevice
|
|||
|
||||
from homeassistant.components import ssdp
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.const import CONF_HOST, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, format_mac
|
||||
|
@ -30,7 +30,7 @@ from .const import (
|
|||
ENTITY_CATEGORY_MAPPING,
|
||||
)
|
||||
|
||||
PLATFORMS = ["media_player", "number"]
|
||||
PLATFORMS = [Platform.MEDIA_PLAYER, Platform.NUMBER]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
SCAN_INTERVAL = timedelta(seconds=60)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "yeelight"
|
||||
|
||||
|
||||
|
@ -100,4 +102,4 @@ UPDATE_REQUEST_PROPERTIES = [
|
|||
]
|
||||
|
||||
|
||||
PLATFORMS = ["binary_sensor", "light"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.LIGHT]
|
||||
|
|
|
@ -6,14 +6,14 @@ from urllib.error import URLError
|
|||
from youless_api import YoulessAPI
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.const import CONF_HOST, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
"""Zerproc lights integration."""
|
||||
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
|
||||
|
||||
PLATFORMS = ["light"]
|
||||
PLATFORMS = [Platform.LIGHT]
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue