mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Use Platform constants all over the place 1/3 (#62952)
This commit is contained in:
parent
b5fd2e0d58
commit
bc3bf2ffe3
@ -8,7 +8,7 @@ from typing import Dict
|
|||||||
from aioaseko import APIUnavailable, MobileAccount, Unit, Variable
|
from aioaseko import APIUnavailable, MobileAccount, Unit, Variable
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
from homeassistant.const import CONF_ACCESS_TOKEN, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
@ -18,7 +18,7 @@ from .const import DOMAIN
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
PLATFORMS: list[str] = ["sensor"]
|
PLATFORMS: list[str] = [Platform.SENSOR]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
@ -7,14 +7,14 @@ from aiohttp.hdrs import AUTHORIZATION
|
|||||||
import requests
|
import requests
|
||||||
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
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
PLATFORMS = ["camera", "binary_sensor", "sensor"]
|
PLATFORMS = [Platform.CAMERA, Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||||
|
|
||||||
DOMAIN = "bloomsky"
|
DOMAIN = "bloomsky"
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
"""Allows to configure custom shell commands to turn a value for a sensor."""
|
"""Allows to configure custom shell commands to turn a value for a sensor."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
CONF_COMMAND_TIMEOUT = "command_timeout"
|
CONF_COMMAND_TIMEOUT = "command_timeout"
|
||||||
DEFAULT_TIMEOUT = 15
|
DEFAULT_TIMEOUT = 15
|
||||||
DOMAIN = "command_line"
|
DOMAIN = "command_line"
|
||||||
PLATFORMS = ["binary_sensor", "cover", "sensor", "switch"]
|
PLATFORMS = [
|
||||||
|
Platform.BINARY_SENSOR,
|
||||||
|
Platform.COVER,
|
||||||
|
Platform.SENSOR,
|
||||||
|
Platform.SWITCH,
|
||||||
|
]
|
||||||
|
@ -6,14 +6,14 @@ from pydanfossair.commands import ReadCommand
|
|||||||
from pydanfossair.danfossclient import DanfossClient
|
from pydanfossair.danfossclient import DanfossClient
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST, 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
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
PLATFORMS = ["sensor", "binary_sensor", "switch"]
|
PLATFORMS = [Platform.SENSOR, Platform.BINARY_SENSOR, Platform.SWITCH]
|
||||||
DOMAIN = "danfoss_air"
|
DOMAIN = "danfoss_air"
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
import digitalocean
|
import digitalocean
|
||||||
import voluptuous as vol
|
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
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ ATTRIBUTION = "Data provided by Digital Ocean"
|
|||||||
CONF_DROPLETS = "droplets"
|
CONF_DROPLETS = "droplets"
|
||||||
|
|
||||||
DATA_DIGITAL_OCEAN = "data_do"
|
DATA_DIGITAL_OCEAN = "data_do"
|
||||||
DIGITAL_OCEAN_PLATFORMS = ["switch", "binary_sensor"]
|
DIGITAL_OCEAN_PLATFORMS = [Platform.SWITCH, Platform.BINARY_SENSOR]
|
||||||
DOMAIN = "digital_ocean"
|
DOMAIN = "digital_ocean"
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
"""UK Environment Agency Flood Monitoring Integration."""
|
"""UK Environment Agency Flood Monitoring Integration."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
PLATFORMS = ["sensor"]
|
PLATFORMS = [Platform.SENSOR]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass, entry):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The Elv integration."""
|
"""The Elv integration."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_DEVICE
|
from homeassistant.const import CONF_DEVICE, 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
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ DOMAIN = "elv"
|
|||||||
|
|
||||||
DEFAULT_DEVICE = "/dev/ttyUSB0"
|
DEFAULT_DEVICE = "/dev/ttyUSB0"
|
||||||
|
|
||||||
ELV_PLATFORMS = ["switch"]
|
ELV_PLATFORMS = [Platform.SWITCH]
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""Constants for the ENOcean integration."""
|
"""Constants for the ENOcean integration."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "enocean"
|
DOMAIN = "enocean"
|
||||||
DATA_ENOCEAN = "enocean"
|
DATA_ENOCEAN = "enocean"
|
||||||
ENOCEAN_DONGLE = "dongle"
|
ENOCEAN_DONGLE = "dongle"
|
||||||
@ -12,4 +14,9 @@ SIGNAL_SEND_MESSAGE = "enocean.send_message"
|
|||||||
|
|
||||||
LOGGER = logging.getLogger(__package__)
|
LOGGER = logging.getLogger(__package__)
|
||||||
|
|
||||||
PLATFORMS = ["light", "binary_sensor", "sensor", "switch"]
|
PLATFORMS = [
|
||||||
|
Platform.LIGHT,
|
||||||
|
Platform.BINARY_SENSOR,
|
||||||
|
Platform.SENSOR,
|
||||||
|
Platform.SWITCH,
|
||||||
|
]
|
||||||
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
CONF_WHITE_VALUE,
|
CONF_WHITE_VALUE,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
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
|
||||||
@ -39,14 +40,14 @@ DOMAIN = "fibaro"
|
|||||||
FIBARO_CONTROLLERS = "fibaro_controllers"
|
FIBARO_CONTROLLERS = "fibaro_controllers"
|
||||||
FIBARO_DEVICES = "fibaro_devices"
|
FIBARO_DEVICES = "fibaro_devices"
|
||||||
PLATFORMS = [
|
PLATFORMS = [
|
||||||
"binary_sensor",
|
Platform.BINARY_SENSOR,
|
||||||
"climate",
|
Platform.CLIMATE,
|
||||||
"cover",
|
Platform.COVER,
|
||||||
"light",
|
Platform.LIGHT,
|
||||||
"scene",
|
Platform.SCENE,
|
||||||
"sensor",
|
Platform.SENSOR,
|
||||||
"lock",
|
Platform.LOCK,
|
||||||
"switch",
|
Platform.SWITCH,
|
||||||
]
|
]
|
||||||
|
|
||||||
FIBARO_TYPEMAP = {
|
FIBARO_TYPEMAP = {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""The filesize component."""
|
"""The filesize component."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "filesize"
|
DOMAIN = "filesize"
|
||||||
PLATFORMS = ["sensor"]
|
PLATFORMS = [Platform.SENSOR]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""The filter component."""
|
"""The filter component."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "filter"
|
DOMAIN = "filter"
|
||||||
PLATFORMS = ["sensor"]
|
PLATFORMS = [Platform.SENSOR]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""The generic component."""
|
"""The generic component."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "generic"
|
DOMAIN = "generic"
|
||||||
PLATFORMS = ["camera"]
|
PLATFORMS = [Platform.CAMERA]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""The generic_thermostat component."""
|
"""The generic_thermostat component."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "generic_thermostat"
|
DOMAIN = "generic_thermostat"
|
||||||
PLATFORMS = ["climate"]
|
PLATFORMS = [Platform.CLIMATE]
|
||||||
|
@ -25,6 +25,7 @@ from homeassistant.const import (
|
|||||||
SERVICE_RELOAD,
|
SERVICE_RELOAD,
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import (
|
from homeassistant.core import (
|
||||||
CoreState,
|
CoreState,
|
||||||
@ -62,7 +63,13 @@ ATTR_ALL = "all"
|
|||||||
SERVICE_SET = "set"
|
SERVICE_SET = "set"
|
||||||
SERVICE_REMOVE = "remove"
|
SERVICE_REMOVE = "remove"
|
||||||
|
|
||||||
PLATFORMS = ["light", "cover", "notify", "fan", "binary_sensor"]
|
PLATFORMS = [
|
||||||
|
Platform.LIGHT,
|
||||||
|
Platform.COVER,
|
||||||
|
Platform.NOTIFY,
|
||||||
|
Platform.FAN,
|
||||||
|
Platform.BINARY_SENSOR,
|
||||||
|
]
|
||||||
|
|
||||||
REG_KEY = f"{DOMAIN}_registry"
|
REG_KEY = f"{DOMAIN}_registry"
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""The history_stats component."""
|
"""The history_stats component."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "history_stats"
|
DOMAIN = "history_stats"
|
||||||
PLATFORMS = ["sensor"]
|
PLATFORMS = [Platform.SENSOR]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user