Use Platform constants all over the place 1/3 (#62952)

This commit is contained in:
Sebastian Lövdahl 2021-12-28 22:13:20 +02:00 committed by GitHub
parent b5fd2e0d58
commit bc3bf2ffe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 61 additions and 27 deletions

View File

@ -8,7 +8,7 @@ from typing import Dict
from aioaseko import APIUnavailable, MobileAccount, Unit, Variable
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.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -18,7 +18,7 @@ from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
PLATFORMS: list[str] = ["sensor"]
PLATFORMS: list[str] = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -7,14 +7,14 @@ from aiohttp.hdrs import AUTHORIZATION
import requests
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
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["camera", "binary_sensor", "sensor"]
PLATFORMS = [Platform.CAMERA, Platform.BINARY_SENSOR, Platform.SENSOR]
DOMAIN = "bloomsky"

View File

@ -1,6 +1,13 @@
"""Allows to configure custom shell commands to turn a value for a sensor."""
from homeassistant.const import Platform
CONF_COMMAND_TIMEOUT = "command_timeout"
DEFAULT_TIMEOUT = 15
DOMAIN = "command_line"
PLATFORMS = ["binary_sensor", "cover", "sensor", "switch"]
PLATFORMS = [
Platform.BINARY_SENSOR,
Platform.COVER,
Platform.SENSOR,
Platform.SWITCH,
]

View File

@ -6,14 +6,14 @@ from pydanfossair.commands import ReadCommand
from pydanfossair.danfossclient import DanfossClient
import voluptuous as vol
from homeassistant.const import CONF_HOST
from homeassistant.const import CONF_HOST, Platform
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor", "binary_sensor", "switch"]
PLATFORMS = [Platform.SENSOR, Platform.BINARY_SENSOR, Platform.SWITCH]
DOMAIN = "danfoss_air"
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)

View File

@ -5,7 +5,7 @@ import logging
import digitalocean
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
@ -26,7 +26,7 @@ ATTRIBUTION = "Data provided by Digital Ocean"
CONF_DROPLETS = "droplets"
DATA_DIGITAL_OCEAN = "data_do"
DIGITAL_OCEAN_PLATFORMS = ["switch", "binary_sensor"]
DIGITAL_OCEAN_PLATFORMS = [Platform.SWITCH, Platform.BINARY_SENSOR]
DOMAIN = "digital_ocean"
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)

View File

@ -1,8 +1,10 @@
"""UK Environment Agency Flood Monitoring Integration."""
from homeassistant.const import Platform
from .const import DOMAIN
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass, entry):

View File

@ -1,7 +1,7 @@
"""The Elv integration."""
import voluptuous as vol
from homeassistant.const import CONF_DEVICE
from homeassistant.const import CONF_DEVICE, Platform
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
@ -9,7 +9,7 @@ DOMAIN = "elv"
DEFAULT_DEVICE = "/dev/ttyUSB0"
ELV_PLATFORMS = ["switch"]
ELV_PLATFORMS = [Platform.SWITCH]
CONFIG_SCHEMA = vol.Schema(
{

View File

@ -1,6 +1,8 @@
"""Constants for the ENOcean integration."""
import logging
from homeassistant.const import Platform
DOMAIN = "enocean"
DATA_ENOCEAN = "enocean"
ENOCEAN_DONGLE = "dongle"
@ -12,4 +14,9 @@ SIGNAL_SEND_MESSAGE = "enocean.send_message"
LOGGER = logging.getLogger(__package__)
PLATFORMS = ["light", "binary_sensor", "sensor", "switch"]
PLATFORMS = [
Platform.LIGHT,
Platform.BINARY_SENSOR,
Platform.SENSOR,
Platform.SWITCH,
]

View File

@ -18,6 +18,7 @@ from homeassistant.const import (
CONF_USERNAME,
CONF_WHITE_VALUE,
EVENT_HOMEASSISTANT_STOP,
Platform,
)
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
@ -39,14 +40,14 @@ DOMAIN = "fibaro"
FIBARO_CONTROLLERS = "fibaro_controllers"
FIBARO_DEVICES = "fibaro_devices"
PLATFORMS = [
"binary_sensor",
"climate",
"cover",
"light",
"scene",
"sensor",
"lock",
"switch",
Platform.BINARY_SENSOR,
Platform.CLIMATE,
Platform.COVER,
Platform.LIGHT,
Platform.SCENE,
Platform.SENSOR,
Platform.LOCK,
Platform.SWITCH,
]
FIBARO_TYPEMAP = {

View File

@ -1,4 +1,6 @@
"""The filesize component."""
from homeassistant.const import Platform
DOMAIN = "filesize"
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]

View File

@ -1,4 +1,6 @@
"""The filter component."""
from homeassistant.const import Platform
DOMAIN = "filter"
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]

View File

@ -1,4 +1,6 @@
"""The generic component."""
from homeassistant.const import Platform
DOMAIN = "generic"
PLATFORMS = ["camera"]
PLATFORMS = [Platform.CAMERA]

View File

@ -1,4 +1,6 @@
"""The generic_thermostat component."""
from homeassistant.const import Platform
DOMAIN = "generic_thermostat"
PLATFORMS = ["climate"]
PLATFORMS = [Platform.CLIMATE]

View File

@ -25,6 +25,7 @@ from homeassistant.const import (
SERVICE_RELOAD,
STATE_OFF,
STATE_ON,
Platform,
)
from homeassistant.core import (
CoreState,
@ -62,7 +63,13 @@ ATTR_ALL = "all"
SERVICE_SET = "set"
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"

View File

@ -1,4 +1,6 @@
"""The history_stats component."""
from homeassistant.const import Platform
DOMAIN = "history_stats"
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]