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