Use platform enum (4) [M-O] (#60940)

This commit is contained in:
Marc Mueller 2021-12-06 04:06:35 +01:00 committed by GitHub
parent a7e129a952
commit e0cb33a0a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 112 additions and 82 deletions

View File

@ -14,7 +14,7 @@ from pymazda import (
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_REGION
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_REGION, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import (
ConfigEntryAuthFailed,
@ -34,7 +34,7 @@ from .const import DATA_CLIENT, DATA_COORDINATOR, DATA_VEHICLES, DOMAIN, SERVICE
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["device_tracker", "lock", "sensor"]
PLATFORMS = [Platform.DEVICE_TRACKER, Platform.LOCK, Platform.SENSOR]
async def with_timeout(task, timeout_seconds=10):

View File

@ -12,7 +12,7 @@ from pymelcloud import Device, get_devices
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_TOKEN, CONF_USERNAME
from homeassistant.const import CONF_TOKEN, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv
@ -27,7 +27,7 @@ _LOGGER = logging.getLogger(__name__)
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
PLATFORMS = ["climate", "sensor", "water_heater"]
PLATFORMS = [Platform.CLIMATE, Platform.SENSOR, Platform.WATER_HEATER]
CONF_LANGUAGE = "language"
CONFIG_SCHEMA = vol.Schema(

View File

@ -18,6 +18,7 @@ from homeassistant.const import (
EVENT_CORE_CONFIG_UPDATE,
LENGTH_FEET,
LENGTH_METERS,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -34,7 +35,7 @@ from .const import (
URL = "https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete"
PLATFORMS = ["weather"]
PLATFORMS = [Platform.WEATHER]
_LOGGER = logging.getLogger(__name__)

View File

@ -4,7 +4,7 @@ import logging
import meteireann
from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE, Platform
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
import homeassistant.util.dt as dt_util
@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
UPDATE_INTERVAL = timedelta(minutes=60)
PLATFORMS = ["weather"]
PLATFORMS = [Platform.WEATHER]
async def async_setup_entry(hass, config_entry):

View File

@ -34,10 +34,11 @@ from homeassistant.const import (
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
UV_INDEX,
Platform,
)
DOMAIN = "meteo_france"
PLATFORMS = ["sensor", "weather"]
PLATFORMS = [Platform.SENSOR, Platform.WEATHER]
COORDINATOR_FORECAST = "coordinator_forecast"
COORDINATOR_RAIN = "coordinator_rain"
COORDINATOR_ALERT = "coordinator_alert"

View File

@ -33,10 +33,11 @@ from homeassistant.const import (
PRESSURE_HPA,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
Platform,
)
DOMAIN = "meteoclimatic"
PLATFORMS = ["sensor", "weather"]
PLATFORMS = [Platform.SENSOR, Platform.WEATHER]
ATTRIBUTION = "Data provided by Meteoclimatic"
MODEL = "Meteoclimatic RSS feed"
MANUFACTURER = "Meteoclimatic"

View File

@ -6,7 +6,13 @@ import logging
import datapoint
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
from homeassistant.const import (
CONF_API_KEY,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_NAME,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.device_registry import DeviceEntryType
@ -28,7 +34,7 @@ from .helpers import fetch_data, fetch_site
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor", "weather"]
PLATFORMS = [Platform.SENSOR, Platform.WEATHER]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -1,4 +1,5 @@
"""Constants used in the Mikrotik components."""
from homeassistant.const import Platform
DOMAIN = "mikrotik"
DEFAULT_NAME = "Mikrotik"
@ -37,7 +38,7 @@ MIKROTIK_SERVICES = {
IS_CAPSMAN: "/caps-man/interface/print",
}
PLATFORMS = ["device_tracker"]
PLATFORMS = [Platform.DEVICE_TRACKER]
ATTR_DEVICE_TRACKER = [
"comment",

View File

@ -7,7 +7,7 @@ import logging
from mill import Mill
from mill_local import Mill as MillLocal
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -17,7 +17,7 @@ from .const import CLOUD, CONNECTION_TYPE, DOMAIN, LOCAL
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["climate", "sensor"]
PLATFORMS = [Platform.CLIMATE, Platform.SENSOR]
class MillDataUpdateCoordinator(DataUpdateCoordinator):

View File

@ -7,7 +7,7 @@ import logging
from mcstatus.server import MinecraftServer as MCStatus
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
@ -20,7 +20,7 @@ from homeassistant.helpers.typing import ConfigType
from . import helpers
from .const import DOMAIN, MANUFACTURER, SCAN_INTERVAL, SIGNAL_NAME_PREFIX
PLATFORMS = ["binary_sensor", "sensor"]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
_LOGGER = logging.getLogger(__name__)

View File

@ -6,7 +6,7 @@ from homeassistant.components.webhook import (
async_register as webhook_register,
async_unregister as webhook_unregister,
)
from homeassistant.const import ATTR_DEVICE_ID, CONF_WEBHOOK_ID
from homeassistant.const import ATTR_DEVICE_ID, CONF_WEBHOOK_ID, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, discovery
from homeassistant.helpers.typing import ConfigType
@ -31,7 +31,7 @@ from .helpers import savable_state
from .http_api import RegistrationsView
from .webhook import handle_webhook
PLATFORMS = "sensor", "binary_sensor", "device_tracker"
PLATFORMS = [Platform.SENSOR, Platform.BINARY_SENSOR, Platform.DEVICE_TRACKER]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:

View File

@ -1,15 +1,14 @@
"""The Modem Caller ID integration."""
from phone_modem import PhoneModem
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE
from homeassistant.const import CONF_DEVICE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from .const import DATA_KEY_API, DOMAIN, EXCEPTIONS
PLATFORMS = [SENSOR_DOMAIN]
PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -11,13 +11,8 @@ from aiomodernforms import (
)
from aiomodernforms.models import Device as ModernFormsDeviceState
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.fan import DOMAIN as FAN_DOMAIN
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST
from homeassistant.const import CONF_HOST, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.entity import DeviceInfo
@ -31,11 +26,11 @@ from .const import DOMAIN
SCAN_INTERVAL = timedelta(seconds=5)
PLATFORMS = [
BINARY_SENSOR_DOMAIN,
LIGHT_DOMAIN,
FAN_DOMAIN,
SENSOR_DOMAIN,
SWITCH_DOMAIN,
Platform.BINARY_SENSOR,
Platform.LIGHT,
Platform.FAN,
Platform.SENSOR,
Platform.SWITCH,
]
_LOGGER = logging.getLogger(__name__)

View File

@ -5,7 +5,7 @@ from pymonoprice import get_monoprice
from serial import SerialException
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PORT
from homeassistant.const import CONF_PORT, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
@ -17,7 +17,7 @@ from .const import (
UNDO_UPDATE_LISTENER,
)
PLATFORMS = ["media_player"]
PLATFORMS = [Platform.MEDIA_PLAYER]
_LOGGER = logging.getLogger(__name__)

View File

@ -1,9 +1,11 @@
"""Constants for the Motion Blinds component."""
from homeassistant.const import Platform
DOMAIN = "motion_blinds"
MANUFACTURER = "Motion Blinds, Coulisse B.V."
DEFAULT_GATEWAY_NAME = "Motion Blinds Gateway"
PLATFORMS = ["cover", "sensor"]
PLATFORMS = [Platform.COVER, Platform.SENSOR]
CONF_WAIT_FOR_PUSH = "wait_for_push"
CONF_INTERFACE = "interface"

View File

@ -6,12 +6,13 @@ import async_timeout
from mullvad_api import MullvadAPI
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import update_coordinator
from .const import DOMAIN
PLATFORMS = ["binary_sensor"]
PLATFORMS = [Platform.BINARY_SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: dict) -> bool:

View File

@ -7,12 +7,13 @@ import async_timeout
import mutesync
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import update_coordinator
from .const import DOMAIN, UPDATE_INTERVAL_IN_MEETING, UPDATE_INTERVAL_NOT_IN_MEETING
PLATFORMS = ["binary_sensor"]
PLATFORMS = [Platform.BINARY_SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -14,11 +14,12 @@ from homeassistant.const import (
STATE_ON,
STATE_OPEN,
STATE_OPENING,
Platform,
)
DOMAIN = "myq"
PLATFORMS = ["cover", "binary_sensor", "light"]
PLATFORMS = [Platform.COVER, Platform.BINARY_SENSOR, Platform.LIGHT]
MYQ_TO_HASS = {
MYQ_COVER_STATE_CLOSED: STATE_CLOSED,

View File

@ -18,7 +18,7 @@ from nettigo_air_monitor import (
from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -42,7 +42,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["button", "sensor"]
PLATFORMS = [Platform.BUTTON, Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -7,7 +7,7 @@ from dataclasses import dataclass
from aionanoleaf import EffectsEvent, InvalidToken, Nanoleaf, StateEvent, Unavailable
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_TOKEN
from homeassistant.const import CONF_HOST, CONF_TOKEN, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -15,7 +15,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import DOMAIN
PLATFORMS = ["button", "light"]
PLATFORMS = [Platform.BUTTON, Platform.LIGHT]
@dataclass

View File

@ -7,7 +7,7 @@ from pybotvac.exceptions import NeatoException
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, CONF_TOKEN
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, CONF_TOKEN, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
@ -32,7 +32,7 @@ CONFIG_SCHEMA = vol.Schema(
extra=vol.ALLOW_EXTRA,
)
PLATFORMS = ["camera", "vacuum", "switch", "sensor"]
PLATFORMS = [Platform.CAMERA, Platform.VACUUM, Platform.SWITCH, Platform.SENSOR]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:

View File

@ -24,6 +24,7 @@ from homeassistant.const import (
CONF_MONITORED_CONDITIONS,
CONF_SENSORS,
CONF_STRUCTURE,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import (
@ -82,7 +83,7 @@ CONFIG_SCHEMA = vol.Schema(
)
# Platforms for SDM API
PLATFORMS = ["sensor", "camera", "climate"]
PLATFORMS = [Platform.SENSOR, Platform.CAMERA, Platform.CLIMATE]
WEB_AUTH_DOMAIN = DOMAIN
INSTALLED_AUTH_DOMAIN = f"{DOMAIN}.installed"

View File

@ -1,9 +1,5 @@
"""Constants used by the Netatmo component."""
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import Platform
API = "api"
@ -11,7 +7,13 @@ DOMAIN = "netatmo"
MANUFACTURER = "Netatmo"
DEFAULT_ATTRIBUTION = f"Data provided by {MANUFACTURER}"
PLATFORMS = [CAMERA_DOMAIN, CLIMATE_DOMAIN, LIGHT_DOMAIN, SELECT_DOMAIN, SENSOR_DOMAIN]
PLATFORMS = [
Platform.CAMERA,
Platform.CLIMATE,
Platform.LIGHT,
Platform.SELECT,
Platform.SENSOR,
]
NETATMO_SCOPES = [
"access_camera",

View File

@ -1,9 +1,11 @@
"""Netgear component constants."""
from datetime import timedelta
from homeassistant.const import Platform
DOMAIN = "netgear"
PLATFORMS = ["device_tracker", "sensor"]
PLATFORMS = [Platform.DEVICE_TRACKER, Platform.SENSOR]
CONF_CONSIDER_HOME = "consider_home"

View File

@ -1,6 +1,7 @@
"""Nexia constants."""
from homeassistant.const import Platform
PLATFORMS = ["sensor", "binary_sensor", "climate", "scene"]
PLATFORMS = [Platform.SENSOR, Platform.BINARY_SENSOR, Platform.CLIMATE, Platform.SCENE]
ATTRIBUTION = "Data provided by mynexia.com"

View File

@ -5,7 +5,7 @@ from aiohttp import ClientError
from py_nightscout import Api as NightscoutAPI
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_URL
from homeassistant.const import CONF_API_KEY, CONF_URL, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr
@ -14,7 +14,7 @@ from homeassistant.helpers.entity import SLOW_UPDATE_WARNING
from .const import DOMAIN
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]
_API_TIMEOUT = SLOW_UPDATE_WARNING - 1

View File

@ -1,9 +1,11 @@
"""The Nmap Tracker integration."""
from typing import Final
from homeassistant.const import Platform
DOMAIN: Final = "nmap_tracker"
PLATFORMS: Final = ["device_tracker"]
PLATFORMS: Final = [Platform.DEVICE_TRACKER]
NMAP_TRACKED_DEVICES: Final = "nmap_tracked_devices"

View File

@ -9,7 +9,7 @@ from aionotion import async_get_client
from aionotion.errors import InvalidCredentialsError, NotionError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import (
@ -26,7 +26,7 @@ from homeassistant.helpers.update_coordinator import (
from .const import DOMAIN, LOGGER
PLATFORMS = ["binary_sensor", "sensor"]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
ATTR_SYSTEM_MODE = "system_mode"
ATTR_SYSTEM_NAME = "system_name"

View File

@ -1,8 +1,9 @@
"""Constants for NuHeat thermostats."""
from homeassistant.const import Platform
DOMAIN = "nuheat"
PLATFORMS = ["climate"]
PLATFORMS = [Platform.CLIMATE]
CONF_SERIAL_NUMBER = "serial_number"

View File

@ -10,7 +10,13 @@ from requests.exceptions import RequestException
from homeassistant import exceptions
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_HOST, CONF_PLATFORM, CONF_PORT, CONF_TOKEN
from homeassistant.const import (
CONF_HOST,
CONF_PLATFORM,
CONF_PORT,
CONF_TOKEN,
Platform,
)
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
@ -30,7 +36,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["binary_sensor", "lock"]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.LOCK]
UPDATE_INTERVAL = timedelta(seconds=30)

View File

@ -18,12 +18,13 @@ from homeassistant.const import (
POWER_WATT,
TEMP_CELSIUS,
TIME_SECONDS,
Platform,
)
from homeassistant.helpers.entity import EntityCategory
DOMAIN = "nut"
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]
UNDO_UPDATE_LISTENER = "undo_update_listener"

View File

@ -8,7 +8,7 @@ import logging
from pynws import SimpleNWS
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import debounce
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -29,7 +29,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor", "weather"]
PLATFORMS = [Platform.SENSOR, Platform.WEATHER]
DEFAULT_SCAN_INTERVAL = datetime.timedelta(minutes=10)
FAILED_SCAN_INTERVAL = datetime.timedelta(minutes=1)

View File

@ -10,6 +10,7 @@ from homeassistant.const import (
CONF_SCAN_INTERVAL,
CONF_SSL,
CONF_USERNAME,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
@ -32,7 +33,7 @@ from .const import (
)
from .coordinator import NZBGetDataUpdateCoordinator
PLATFORMS = ["sensor", "switch"]
PLATFORMS = [Platform.SENSOR, Platform.SWITCH]
CONFIG_SCHEMA = vol.Schema(
vol.All(

View File

@ -18,6 +18,7 @@ from homeassistant.const import (
CONF_PORT,
CONF_SENSORS,
CONF_SSL,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -49,7 +50,7 @@ def ensure_valid_path(value):
return value
PLATFORMS = ["binary_sensor", "sensor"]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
DEFAULT_NAME = "OctoPrint"
CONF_NUMBER_OF_TOOLS = "number_of_tools"
CONF_BED = "bed"

View File

@ -4,7 +4,7 @@ import logging
from omnilogic import LoginException, OmniLogic, OmniLogicException
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import aiohttp_client
@ -20,7 +20,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor", "switch"]
PLATFORMS = [Platform.SENSOR, Platform.SWITCH]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -1,6 +1,7 @@
"""The Ondilo ICO integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow
@ -8,7 +9,7 @@ from . import api, config_flow
from .const import DOMAIN
from .oauth_impl import OndiloOauth2Implementation
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -12,6 +12,7 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP,
HTTP_BASIC_AUTHENTICATION,
HTTP_DIGEST_AUTHENTICATION,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
@ -82,10 +83,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN][entry.unique_id] = device
platforms = ["camera"]
platforms = [Platform.CAMERA]
if device.capabilities.events:
platforms += ["binary_sensor", "sensor"]
platforms += [Platform.BINARY_SENSOR, Platform.SENSOR]
hass.config_entries.async_setup_platforms(entry, platforms)

View File

@ -7,7 +7,7 @@ import logging
import opengarage
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_VERIFY_SSL
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_VERIFY_SSL, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import update_coordinator
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -16,7 +16,7 @@ from .const import CONF_DEVICE_KEY, DOMAIN
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["binary_sensor", "cover", "sensor"]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.COVER, Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -6,9 +6,6 @@ import pyotgw
import pyotgw.vars as gw_vars
import voluptuous as vol
from homeassistant.components.binary_sensor import DOMAIN as COMP_BINARY_SENSOR
from homeassistant.components.climate import DOMAIN as COMP_CLIMATE
from homeassistant.components.sensor import DOMAIN as COMP_SENSOR
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
ATTR_DATE,
@ -23,6 +20,7 @@ from homeassistant.const import (
PRECISION_HALVES,
PRECISION_TENTHS,
PRECISION_WHOLE,
Platform,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import (
@ -80,7 +78,7 @@ CONFIG_SCHEMA = vol.Schema(
extra=vol.ALLOW_EXTRA,
)
PLATFORMS = [COMP_BINARY_SENSOR, COMP_CLIMATE, COMP_SENSOR]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.CLIMATE, Platform.SENSOR]
async def options_updated(hass, entry):

View File

@ -15,6 +15,7 @@ from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_SENSORS,
Platform,
)
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import ConfigEntryNotReady
@ -44,7 +45,7 @@ NOTIFICATION_TITLE = "OpenUV Component Setup"
TOPIC_UPDATE = f"{DOMAIN}_data_update"
PLATFORMS = ["binary_sensor", "sensor"]
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -40,6 +40,7 @@ from homeassistant.const import (
SPEED_METERS_PER_SECOND,
TEMP_CELSIUS,
UV_INDEX,
Platform,
)
DOMAIN = "openweathermap"
@ -70,7 +71,7 @@ ATTR_API_UV_INDEX = "uv_index"
ATTR_API_WEATHER_CODE = "weather_code"
ATTR_API_FORECAST = "forecast"
UPDATE_LISTENER = "update_listener"
PLATFORMS = ["sensor", "weather"]
PLATFORMS = [Platform.SENSOR, Platform.WEATHER]
FORECAST_MODE_HOURLY = "hourly"
FORECAST_MODE_DAILY = "daily"

View File

@ -10,7 +10,7 @@ from ovoenergy import OVODailyUsage
from ovoenergy.ovoenergy import OVOEnergy
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.device_registry import DeviceEntryType
@ -26,7 +26,7 @@ from .const import DATA_CLIENT, DATA_COORDINATOR, DOMAIN
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -14,6 +14,7 @@ from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
CONF_WEBHOOK_ID,
Platform,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
@ -32,7 +33,7 @@ CONF_MQTT_TOPIC = "mqtt_topic"
CONF_REGION_MAPPING = "region_mapping"
CONF_EVENTS_ONLY = "events_only"
BEACON_DEV_ID = "beacon"
PLATFORMS = ["device_tracker"]
PLATFORMS = [Platform.DEVICE_TRACKER]
DEFAULT_OWNTRACKS_TOPIC = "owntracks/#"