Use Platform constants all over the place 3/3 (#62954)
parent
d18f1cc872
commit
53f4a3d8bc
|
@ -23,6 +23,7 @@ from homeassistant.const import (
|
|||
CONF_VERIFY_SSL,
|
||||
HTTP_DIGEST_AUTHENTICATION,
|
||||
SERVICE_RELOAD,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import discovery, template
|
||||
|
@ -40,7 +41,13 @@ from .schema import CONFIG_SCHEMA # noqa: F401
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = ["binary_sensor", "notify", "sensor", "switch"]
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.NOTIFY,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
COORDINATOR_AWARE_PLATFORMS = [SENSOR_DOMAIN, BINARY_SENSOR_DOMAIN]
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
"""Support for controlling GPIO pins of a Raspberry Pi."""
|
||||
from RPi import GPIO # pylint: disable=import-error
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
|
||||
DOMAIN = "rpi_gpio"
|
||||
PLATFORMS = ["binary_sensor", "cover", "switch"]
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.COVER,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""The smtp component."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "smtp"
|
||||
PLATFORMS = ["notify"]
|
||||
PLATFORMS = [Platform.NOTIFY]
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""The statistics component."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "statistics"
|
||||
PLATFORMS = ["sensor"]
|
||||
PLATFORMS = [Platform.SENSOR]
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from streamlabswater import streamlabswater
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.const import CONF_API_KEY, Platform
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -17,7 +17,7 @@ SERVICE_SET_AWAY_MODE = "set_away_mode"
|
|||
AWAY_MODE_AWAY = "away"
|
||||
AWAY_MODE_HOME = "home"
|
||||
|
||||
PLATFORMS = ["sensor", "binary_sensor"]
|
||||
PLATFORMS = [Platform.SENSOR, Platform.BINARY_SENSOR]
|
||||
|
||||
CONF_LOCATION_ID = "location_id"
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""The telegram component."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "telegram"
|
||||
PLATFORMS = ["notify"]
|
||||
PLATFORMS = [Platform.NOTIFY]
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Constants for the Template Platform Components."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
CONF_AVAILABILITY_TEMPLATE = "availability_template"
|
||||
CONF_ATTRIBUTE_TEMPLATES = "attribute_templates"
|
||||
CONF_TRIGGER = "trigger"
|
||||
|
@ -9,18 +11,18 @@ DOMAIN = "template"
|
|||
PLATFORM_STORAGE_KEY = "template_platforms"
|
||||
|
||||
PLATFORMS = [
|
||||
"alarm_control_panel",
|
||||
"binary_sensor",
|
||||
"cover",
|
||||
"fan",
|
||||
"light",
|
||||
"lock",
|
||||
"number",
|
||||
"select",
|
||||
"sensor",
|
||||
"switch",
|
||||
"vacuum",
|
||||
"weather",
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.COVER,
|
||||
Platform.FAN,
|
||||
Platform.LIGHT,
|
||||
Platform.LOCK,
|
||||
Platform.NUMBER,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
Platform.VACUUM,
|
||||
Platform.WEATHER,
|
||||
]
|
||||
|
||||
CONF_AVAILABILITY = "availability"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""A sensor that monitors trends in other components."""
|
||||
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "trend"
|
||||
PLATFORMS = ["binary_sensor"]
|
||||
PLATFORMS = [Platform.BINARY_SENSOR]
|
||||
|
|
|
@ -4,7 +4,12 @@ import logging
|
|||
from pyvlx import PyVLX, PyVLXException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import ServiceCall, callback
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -12,7 +17,7 @@ from homeassistant.helpers.entity import Entity
|
|||
|
||||
DOMAIN = "velux"
|
||||
DATA_VELUX = "data_velux"
|
||||
PLATFORMS = ["cover", "light", "scene"]
|
||||
PLATFORMS = [Platform.COVER, Platform.LIGHT, Platform.SCENE]
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
|
|
|
@ -20,7 +20,7 @@ from .const import (
|
|||
VS_SWITCHES,
|
||||
)
|
||||
|
||||
PLATFORMS = ["switch", "fan", "light"]
|
||||
PLATFORMS = [Platform.SWITCH, Platform.FAN, Platform.LIGHT]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import voluptuous as vol
|
||||
from vultr import Vultr as VultrAPI
|
||||
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.const import CONF_API_KEY, Platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
|
@ -35,7 +35,7 @@ DOMAIN = "vultr"
|
|||
NOTIFICATION_ID = "vultr_notification"
|
||||
NOTIFICATION_TITLE = "Vultr Setup"
|
||||
|
||||
VULTR_PLATFORMS = ["binary_sensor", "sensor", "switch"]
|
||||
VULTR_PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR, Platform.SWITCH]
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ from homeassistant.const import (
|
|||
CONF_PORT,
|
||||
CONF_SSL,
|
||||
CONF_USERNAME,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -38,7 +39,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLATFORMS = ["climate", "sensor", "switch"]
|
||||
PLATFORMS = [Platform.CLIMATE, Platform.SENSOR, Platform.SWITCH]
|
||||
|
||||
# Lock used to limit the amount of concurrent update requests
|
||||
# as the XS1 Gateway can only handle a very
|
||||
|
|
Loading…
Reference in New Issue