Use Platform constants all over the place 2/3 (#62953)
This commit is contained in:
parent
c8aabc48f1
commit
d18f1cc872
14 changed files with 70 additions and 34 deletions
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
|||
CONF_URL,
|
||||
CONF_USERNAME,
|
||||
TEMP_CELSIUS,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import discovery
|
||||
|
@ -55,7 +56,12 @@ DOMAIN = "ihc"
|
|||
|
||||
IHC_CONTROLLER = "controller"
|
||||
IHC_INFO = "info"
|
||||
PLATFORMS = ("binary_sensor", "light", "sensor", "switch")
|
||||
PLATFORMS = (
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.LIGHT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
)
|
||||
|
||||
|
||||
def validate_name(config):
|
||||
|
|
|
@ -48,9 +48,9 @@ INSTEON_PLATFORMS = [
|
|||
]
|
||||
|
||||
X10_PLATFORMS = [
|
||||
"binary_sensor",
|
||||
"switch",
|
||||
"light",
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.SWITCH,
|
||||
Platform.LIGHT,
|
||||
]
|
||||
|
||||
CONF_IP_PORT = "ip_port"
|
||||
|
|
|
@ -8,6 +8,7 @@ from homeassistant.const import (
|
|||
CONCENTRATION_PARTS_PER_BILLION,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
PERCENTAGE,
|
||||
Platform,
|
||||
)
|
||||
|
||||
DOMAIN = "kaiterra"
|
||||
|
@ -71,4 +72,4 @@ DEFAULT_AQI_STANDARD = "us"
|
|||
DEFAULT_PREFERRED_UNIT = []
|
||||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
PLATFORMS = ["sensor", "air_quality"]
|
||||
PLATFORMS = [Platform.SENSOR, Platform.AIR_QUALITY]
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import linode
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, Platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
|
@ -23,7 +23,7 @@ ATTR_VCPUS = "vcpus"
|
|||
CONF_NODES = "nodes"
|
||||
|
||||
DATA_LINODE = "data_li"
|
||||
LINODE_PLATFORMS = ["binary_sensor", "switch"]
|
||||
LINODE_PLATFORMS = [Platform.BINARY_SENSOR, Platform.SWITCH]
|
||||
DOMAIN = "linode"
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
||||
|
|
|
@ -6,7 +6,13 @@ import lupupy
|
|||
from lupupy.exceptions import LupusecException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_NAME, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import (
|
||||
CONF_IP_ADDRESS,
|
||||
CONF_NAME,
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.helpers import config_validation as cv, discovery
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
|
@ -31,7 +37,11 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
LUPUSEC_PLATFORMS = ["alarm_control_panel", "binary_sensor", "switch"]
|
||||
LUPUSEC_PLATFORMS = [
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
|
|
|
@ -4,7 +4,13 @@ import logging
|
|||
from pylutron import Button, Lutron
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import ATTR_ID, CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import (
|
||||
ATTR_ID,
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
@ -12,7 +18,13 @@ from homeassistant.util import slugify
|
|||
|
||||
DOMAIN = "lutron"
|
||||
|
||||
PLATFORMS = ["light", "cover", "switch", "scene", "binary_sensor"]
|
||||
PLATFORMS = [
|
||||
Platform.LIGHT,
|
||||
Platform.COVER,
|
||||
Platform.SWITCH,
|
||||
Platform.SCENE,
|
||||
Platform.BINARY_SENSOR,
|
||||
]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""The min_max component."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "min_max"
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
|
|
@ -38,6 +38,7 @@ from homeassistant.const import (
|
|||
CONF_USERNAME,
|
||||
HTTP_BASIC_AUTHENTICATION,
|
||||
HTTP_DIGEST_AUTHENTICATION,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
|
@ -65,7 +66,7 @@ from .const import (
|
|||
TYPE_MOTIONEYE_MJPEG_CAMERA,
|
||||
)
|
||||
|
||||
PLATFORMS = ["camera"]
|
||||
PLATFORMS = [Platform.CAMERA]
|
||||
|
||||
SCHEMA_TEXT_OVERLAY = vol.In(
|
||||
[
|
||||
|
|
|
@ -32,6 +32,7 @@ from homeassistant.const import (
|
|||
CONF_VALUE_TEMPLATE,
|
||||
EVENT_HOMEASSISTANT_STARTED,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
|
@ -127,20 +128,20 @@ DISCOVERY_COOLDOWN = 2
|
|||
TIMEOUT_ACK = 10
|
||||
|
||||
PLATFORMS = [
|
||||
"alarm_control_panel",
|
||||
"binary_sensor",
|
||||
"camera",
|
||||
"climate",
|
||||
"cover",
|
||||
"fan",
|
||||
"humidifier",
|
||||
"light",
|
||||
"lock",
|
||||
"number",
|
||||
"scene",
|
||||
"sensor",
|
||||
"switch",
|
||||
"vacuum",
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CAMERA,
|
||||
Platform.CLIMATE,
|
||||
Platform.COVER,
|
||||
Platform.FAN,
|
||||
Platform.HUMIDIFIER,
|
||||
Platform.LIGHT,
|
||||
Platform.LOCK,
|
||||
Platform.NUMBER,
|
||||
Platform.SCENE,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
Platform.VACUUM,
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ from homeassistant.const import (
|
|||
CONF_SCAN_INTERVAL,
|
||||
CONF_URL,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.helpers import config_validation as cv, discovery
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
|
@ -17,7 +18,7 @@ from homeassistant.helpers.event import track_time_interval
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DOMAIN = "nextcloud"
|
||||
PLATFORMS = ("sensor", "binary_sensor")
|
||||
PLATFORMS = (Platform.SENSOR, Platform.BINARY_SENSOR)
|
||||
SCAN_INTERVAL = timedelta(seconds=60)
|
||||
|
||||
# Validate user configuration
|
||||
|
|
|
@ -8,7 +8,7 @@ import sys
|
|||
from pycarwings2 import CarwingsError, Session
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME, Platform
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import load_platform
|
||||
|
@ -82,7 +82,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLATFORMS = ["sensor", "switch", "binary_sensor"]
|
||||
PLATFORMS = [Platform.SENSOR, Platform.SWITCH, Platform.BINARY_SENSOR]
|
||||
|
||||
SIGNAL_UPDATE_LEAF = "nissan_leaf_update"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Constants for the Plex component."""
|
||||
from homeassistant.const import __version__
|
||||
from homeassistant.const import Platform, __version__
|
||||
|
||||
DOMAIN = "plex"
|
||||
NAME_FORMAT = "Plex ({})"
|
||||
|
@ -16,7 +16,7 @@ DEBOUNCE_TIMEOUT = 1
|
|||
DISPATCHERS = "dispatchers"
|
||||
GDM_DEBOUNCER = "gdm_debouncer"
|
||||
GDM_SCANNER = "gdm_scanner"
|
||||
PLATFORMS = frozenset(["media_player", "sensor"])
|
||||
PLATFORMS = frozenset([Platform.MEDIA_PLAYER, Platform.SENSOR])
|
||||
PLATFORMS_COMPLETED = "platforms_completed"
|
||||
PLAYER_SOURCE = "player_source"
|
||||
SERVERS = "servers"
|
||||
|
|
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||
CONF_CLIENT_SECRET,
|
||||
CONF_TOKEN,
|
||||
CONF_WEBHOOK_ID,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
@ -41,7 +42,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
DATA_CONFIG_ENTRY_LOCK = "point_config_entry_lock"
|
||||
CONFIG_ENTRY_IS_SETUP = "point_config_entry_is_setup"
|
||||
|
||||
PLATFORMS = ["binary_sensor", "sensor"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.const import (
|
|||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -26,7 +27,7 @@ from homeassistant.helpers.update_coordinator import (
|
|||
DataUpdateCoordinator,
|
||||
)
|
||||
|
||||
PLATFORMS = ["binary_sensor"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR]
|
||||
DOMAIN = "proxmoxve"
|
||||
PROXMOX_CLIENTS = "proxmox_clients"
|
||||
CONF_REALM = "realm"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue