From cd1b923e16c93665d01bff8872465c9a746c6120 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 4 Dec 2021 13:26:40 +0100 Subject: [PATCH] Use platform enum (2) [E-G] (#60933) --- homeassistant/components/ecobee/const.py | 9 ++++++++- homeassistant/components/econet/__init__.py | 9 +++++++-- homeassistant/components/efergy/__init__.py | 5 ++--- homeassistant/components/elgato/__init__.py | 6 ++---- homeassistant/components/elkm1/__init__.py | 13 +++++++------ homeassistant/components/emonitor/__init__.py | 4 ++-- homeassistant/components/enphase_envoy/const.py | 9 +++++++-- .../components/environment_canada/__init__.py | 4 ++-- homeassistant/components/epson/__init__.py | 5 ++--- .../components/evil_genius_labs/__init__.py | 3 ++- homeassistant/components/ezviz/__init__.py | 9 +++++---- homeassistant/components/faa_delays/__init__.py | 4 ++-- .../components/fireservicerota/__init__.py | 7 ++----- homeassistant/components/fjaraskupan/__init__.py | 9 ++++++++- homeassistant/components/flick_electric/__init__.py | 3 ++- homeassistant/components/flipr/__init__.py | 4 ++-- homeassistant/components/flo/__init__.py | 4 ++-- homeassistant/components/flume/const.py | 3 ++- homeassistant/components/flunearyou/__init__.py | 4 ++-- homeassistant/components/flux_led/__init__.py | 11 ++++++++--- homeassistant/components/forecast_solar/__init__.py | 4 ++-- homeassistant/components/forked_daapd/__init__.py | 4 ++-- homeassistant/components/foscam/__init__.py | 10 ++++++++-- homeassistant/components/freebox/const.py | 4 ++-- homeassistant/components/fritz/const.py | 9 ++++++++- homeassistant/components/fritzbox/const.py | 10 +++++++++- .../components/fritzbox_callmonitor/const.py | 3 ++- homeassistant/components/fronius/__init__.py | 4 ++-- .../components/garages_amsterdam/__init__.py | 3 ++- homeassistant/components/gdacs/const.py | 4 +++- homeassistant/components/geofency/__init__.py | 4 ++-- homeassistant/components/geonetnz_quakes/const.py | 4 +++- homeassistant/components/geonetnz_volcano/const.py | 4 +++- homeassistant/components/gios/__init__.py | 3 ++- homeassistant/components/glances/__init__.py | 3 ++- homeassistant/components/goalzero/__init__.py | 13 ++++++++----- homeassistant/components/gogogate2/__init__.py | 6 ++---- .../components/google_travel_time/__init__.py | 3 ++- homeassistant/components/gpslogger/__init__.py | 9 +++------ homeassistant/components/gree/__init__.py | 5 ++--- homeassistant/components/growatt_server/const.py | 4 +++- homeassistant/components/guardian/__init__.py | 3 ++- 42 files changed, 150 insertions(+), 91 deletions(-) diff --git a/homeassistant/components/ecobee/const.py b/homeassistant/components/ecobee/const.py index caf25690a9d..50dd606ad25 100644 --- a/homeassistant/components/ecobee/const.py +++ b/homeassistant/components/ecobee/const.py @@ -14,6 +14,7 @@ from homeassistant.components.weather import ( ATTR_CONDITION_SUNNY, ATTR_CONDITION_WINDY, ) +from homeassistant.const import Platform _LOGGER = logging.getLogger(__package__) @@ -37,7 +38,13 @@ ECOBEE_MODEL_TO_NAME = { "vulcanSmart": "ecobee4 Smart", } -PLATFORMS = ["binary_sensor", "climate", "humidifier", "sensor", "weather"] +PLATFORMS = [ + Platform.BINARY_SENSOR, + Platform.CLIMATE, + Platform.HUMIDIFIER, + Platform.SENSOR, + Platform.WEATHER, +] MANUFACTURER = "ecobee" diff --git a/homeassistant/components/econet/__init__.py b/homeassistant/components/econet/__init__.py index 8e39a6a6267..c3abea82d7f 100644 --- a/homeassistant/components/econet/__init__.py +++ b/homeassistant/components/econet/__init__.py @@ -12,7 +12,7 @@ from pyeconet.errors import ( PyeconetError, ) -from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, TEMP_FAHRENHEIT +from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, TEMP_FAHRENHEIT, Platform from homeassistant.core import callback from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.dispatcher import dispatcher_send @@ -23,7 +23,12 @@ from .const import API_CLIENT, DOMAIN, EQUIPMENT _LOGGER = logging.getLogger(__name__) -PLATFORMS = ["climate", "binary_sensor", "sensor", "water_heater"] +PLATFORMS = [ + Platform.CLIMATE, + Platform.BINARY_SENSOR, + Platform.SENSOR, + Platform.WATER_HEATER, +] PUSH_UPDATE = "econet.push_update" INTERVAL = timedelta(minutes=60) diff --git a/homeassistant/components/efergy/__init__.py b/homeassistant/components/efergy/__init__.py index dd6c6001259..372dbe77e75 100644 --- a/homeassistant/components/efergy/__init__.py +++ b/homeassistant/components/efergy/__init__.py @@ -3,9 +3,8 @@ from __future__ import annotations from pyefergy import Efergy, exceptions -from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY +from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers import device_registry as dr @@ -14,7 +13,7 @@ from homeassistant.helpers.entity import DeviceInfo, Entity from .const import ATTRIBUTION, DATA_KEY_API, DEFAULT_NAME, DOMAIN -PLATFORMS = [SENSOR_DOMAIN] +PLATFORMS = [Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/elgato/__init__.py b/homeassistant/components/elgato/__init__.py index c074b3303e7..6ef540365be 100644 --- a/homeassistant/components/elgato/__init__.py +++ b/homeassistant/components/elgato/__init__.py @@ -3,17 +3,15 @@ import logging from elgato import Elgato, ElgatoConnectionError -from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN -from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_HOST, CONF_PORT +from homeassistant.const import CONF_HOST, CONF_PORT, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import DOMAIN -PLATFORMS = [BUTTON_DOMAIN, LIGHT_DOMAIN] +PLATFORMS = [Platform.BUTTON, Platform.LIGHT] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index 07111282c3d..8714a41a9a7 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -22,6 +22,7 @@ from homeassistant.const import ( CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT, + Platform, ) from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError @@ -57,12 +58,12 @@ SYNC_TIMEOUT = 120 _LOGGER = logging.getLogger(__name__) PLATFORMS = [ - "alarm_control_panel", - "climate", - "light", - "scene", - "sensor", - "switch", + Platform.ALARM_CONTROL_PANEL, + Platform.CLIMATE, + Platform.LIGHT, + Platform.SCENE, + Platform.SENSOR, + Platform.SWITCH, ] SPEAK_SERVICE_SCHEMA = vol.Schema( diff --git a/homeassistant/components/emonitor/__init__.py b/homeassistant/components/emonitor/__init__.py index 1cff3c9c30e..3d03c7b8fe6 100644 --- a/homeassistant/components/emonitor/__init__.py +++ b/homeassistant/components/emonitor/__init__.py @@ -5,7 +5,7 @@ import logging from aioemonitor import Emonitor 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 import aiohttp_client from homeassistant.helpers.update_coordinator import DataUpdateCoordinator @@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__) DEFAULT_UPDATE_RATE = 60 -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/enphase_envoy/const.py b/homeassistant/components/enphase_envoy/const.py index ea67b5b633b..7e278d83b86 100644 --- a/homeassistant/components/enphase_envoy/const.py +++ b/homeassistant/components/enphase_envoy/const.py @@ -6,11 +6,16 @@ from homeassistant.components.sensor import ( STATE_CLASS_TOTAL_INCREASING, SensorEntityDescription, ) -from homeassistant.const import DEVICE_CLASS_ENERGY, ENERGY_WATT_HOUR, POWER_WATT +from homeassistant.const import ( + DEVICE_CLASS_ENERGY, + ENERGY_WATT_HOUR, + POWER_WATT, + Platform, +) DOMAIN = "enphase_envoy" -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] COORDINATOR = "coordinator" diff --git a/homeassistant/components/environment_canada/__init__.py b/homeassistant/components/environment_canada/__init__.py index 5e52d3631f6..90227ec997d 100644 --- a/homeassistant/components/environment_canada/__init__.py +++ b/homeassistant/components/environment_canada/__init__.py @@ -6,7 +6,7 @@ import xml.etree.ElementTree as et from env_canada import ECRadar, ECWeather, ec_exc from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE +from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, Platform from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .const import CONF_LANGUAGE, CONF_STATION, DOMAIN @@ -14,7 +14,7 @@ from .const import CONF_LANGUAGE, CONF_STATION, DOMAIN DEFAULT_RADAR_UPDATE_INTERVAL = timedelta(minutes=5) DEFAULT_WEATHER_UPDATE_INTERVAL = timedelta(minutes=5) -PLATFORMS = ["camera", "sensor", "weather"] +PLATFORMS = [Platform.CAMERA, Platform.SENSOR, Platform.WEATHER] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/epson/__init__.py b/homeassistant/components/epson/__init__.py index 036b8df7ca9..9710cb8d96a 100644 --- a/homeassistant/components/epson/__init__.py +++ b/homeassistant/components/epson/__init__.py @@ -7,16 +7,15 @@ from epson_projector.const import ( STATE_UNAVAILABLE as EPSON_STATE_UNAVAILABLE, ) -from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER_PLATFORM 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 .const import DOMAIN, HTTP from .exceptions import CannotConnect, PoweredOff -PLATFORMS = [MEDIA_PLAYER_PLATFORM] +PLATFORMS = [Platform.MEDIA_PLAYER] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/evil_genius_labs/__init__.py b/homeassistant/components/evil_genius_labs/__init__.py index 78445a42e7d..2fbd85938f0 100644 --- a/homeassistant/components/evil_genius_labs/__init__.py +++ b/homeassistant/components/evil_genius_labs/__init__.py @@ -9,6 +9,7 @@ from async_timeout import timeout import pyevilgenius from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import ( aiohttp_client, @@ -19,7 +20,7 @@ from homeassistant.helpers.entity import DeviceInfo from .const import DOMAIN -PLATFORMS = ["light"] +PLATFORMS = [Platform.LIGHT] UPDATE_INTERVAL = 10 diff --git a/homeassistant/components/ezviz/__init__.py b/homeassistant/components/ezviz/__init__.py index d2d98aa04cb..9d6f7864b84 100644 --- a/homeassistant/components/ezviz/__init__.py +++ b/homeassistant/components/ezviz/__init__.py @@ -11,6 +11,7 @@ from homeassistant.const import ( CONF_TYPE, CONF_URL, CONF_USERNAME, + Platform, ) from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady @@ -30,10 +31,10 @@ from .coordinator import EzvizDataUpdateCoordinator _LOGGER = logging.getLogger(__name__) PLATFORMS = [ - "binary_sensor", - "camera", - "sensor", - "switch", + Platform.BINARY_SENSOR, + Platform.CAMERA, + Platform.SENSOR, + Platform.SWITCH, ] diff --git a/homeassistant/components/faa_delays/__init__.py b/homeassistant/components/faa_delays/__init__.py index 205fa016130..8bfcf60f30a 100644 --- a/homeassistant/components/faa_delays/__init__.py +++ b/homeassistant/components/faa_delays/__init__.py @@ -7,7 +7,7 @@ from async_timeout import timeout from faadelays import Airport from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_ID +from homeassistant.const import CONF_ID, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import aiohttp_client from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -16,7 +16,7 @@ from .const import DOMAIN _LOGGER = logging.getLogger(__name__) -PLATFORMS = ["binary_sensor"] +PLATFORMS = [Platform.BINARY_SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/fireservicerota/__init__.py b/homeassistant/components/fireservicerota/__init__.py index aa10a16f088..4cdb7ec0c42 100644 --- a/homeassistant/components/fireservicerota/__init__.py +++ b/homeassistant/components/fireservicerota/__init__.py @@ -10,11 +10,8 @@ from pyfireservicerota import ( InvalidTokenError, ) -from homeassistant.components.binary_sensor import DOMAIN as BINARYSENSOR_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_TOKEN, CONF_URL, CONF_USERNAME +from homeassistant.const import CONF_TOKEN, CONF_URL, CONF_USERNAME, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed from homeassistant.helpers.dispatcher import dispatcher_send @@ -26,7 +23,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60) _LOGGER = logging.getLogger(__name__) -PLATFORMS = [SENSOR_DOMAIN, BINARYSENSOR_DOMAIN, SWITCH_DOMAIN] +PLATFORMS = [Platform.SENSOR, Platform.BINARY_SENSOR, Platform.SWITCH] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/fjaraskupan/__init__.py b/homeassistant/components/fjaraskupan/__init__.py index babcdc6649a..64962a746f7 100644 --- a/homeassistant/components/fjaraskupan/__init__.py +++ b/homeassistant/components/fjaraskupan/__init__.py @@ -12,6 +12,7 @@ from bleak.backends.scanner import AdvertisementData from fjaraskupan import UUID_SERVICE, Device, State, device_filter from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, @@ -23,7 +24,13 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import DISPATCH_DETECTION, DOMAIN -PLATFORMS = ["binary_sensor", "fan", "light", "number", "sensor"] +PLATFORMS = [ + Platform.BINARY_SENSOR, + Platform.FAN, + Platform.LIGHT, + Platform.NUMBER, + Platform.SENSOR, +] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/flick_electric/__init__.py b/homeassistant/components/flick_electric/__init__.py index ca634310659..8fca87a6814 100644 --- a/homeassistant/components/flick_electric/__init__.py +++ b/homeassistant/components/flick_electric/__init__.py @@ -13,6 +13,7 @@ from homeassistant.const import ( CONF_CLIENT_SECRET, CONF_PASSWORD, CONF_USERNAME, + Platform, ) from homeassistant.core import HomeAssistant from homeassistant.helpers import aiohttp_client @@ -21,7 +22,7 @@ from .const import CONF_TOKEN_EXPIRES_IN, CONF_TOKEN_EXPIRY, DOMAIN CONF_ID_TOKEN = "id_token" -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/flipr/__init__.py b/homeassistant/components/flipr/__init__.py index 9280c77f95c..6294d56d850 100644 --- a/homeassistant/components/flipr/__init__.py +++ b/homeassistant/components/flipr/__init__.py @@ -5,7 +5,7 @@ import logging from flipr_api import FliprAPIRestClient from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_ATTRIBUTION, CONF_EMAIL, CONF_PASSWORD +from homeassistant.const import ATTR_ATTRIBUTION, CONF_EMAIL, CONF_PASSWORD, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import DeviceInfo, EntityDescription from homeassistant.helpers.update_coordinator import ( @@ -20,7 +20,7 @@ _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(minutes=60) -PLATFORMS = ["binary_sensor", "sensor"] +PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/flo/__init__.py b/homeassistant/components/flo/__init__.py index 32802ba85d3..2dcca979acc 100644 --- a/homeassistant/components/flo/__init__.py +++ b/homeassistant/components/flo/__init__.py @@ -6,7 +6,7 @@ from aioflo import async_get_api from aioflo.errors import RequestError 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.aiohttp_client import async_get_clientsession @@ -16,7 +16,7 @@ from .device import FloDeviceDataUpdateCoordinator _LOGGER = logging.getLogger(__name__) -PLATFORMS = ["binary_sensor", "sensor", "switch"] +PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR, Platform.SWITCH] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/flume/const.py b/homeassistant/components/flume/const.py index 5060bd96489..95236829bd9 100644 --- a/homeassistant/components/flume/const.py +++ b/homeassistant/components/flume/const.py @@ -2,10 +2,11 @@ from __future__ import annotations from homeassistant.components.sensor import SensorEntityDescription +from homeassistant.const import Platform DOMAIN = "flume" -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] DEFAULT_NAME = "Flume Sensor" diff --git a/homeassistant/components/flunearyou/__init__.py b/homeassistant/components/flunearyou/__init__.py index beb7bec2c2f..1c98f4dceae 100644 --- a/homeassistant/components/flunearyou/__init__.py +++ b/homeassistant/components/flunearyou/__init__.py @@ -10,7 +10,7 @@ from pyflunearyou import Client from pyflunearyou.errors import FluNearYouError from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE +from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import aiohttp_client, config_validation as cv from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -21,7 +21,7 @@ DEFAULT_UPDATE_INTERVAL = timedelta(minutes=30) CONFIG_SCHEMA = cv.deprecated(DOMAIN) -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/flux_led/__init__.py b/homeassistant/components/flux_led/__init__.py index 7ea86af2e9d..cfb39a9f8f1 100644 --- a/homeassistant/components/flux_led/__init__.py +++ b/homeassistant/components/flux_led/__init__.py @@ -14,7 +14,12 @@ from flux_led.scanner import FluxLEDDiscovery from homeassistant import config_entries from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STARTED +from homeassistant.const import ( + CONF_HOST, + CONF_NAME, + EVENT_HOMEASSISTANT_STARTED, + Platform, +) from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr @@ -37,8 +42,8 @@ from .const import ( _LOGGER = logging.getLogger(__name__) PLATFORMS_BY_TYPE: Final = { - DeviceType.Bulb: ["light", "number"], - DeviceType.Switch: ["switch"], + DeviceType.Bulb: [Platform.LIGHT, Platform.NUMBER], + DeviceType.Switch: [Platform.SWITCH], } DISCOVERY_INTERVAL: Final = timedelta(minutes=15) REQUEST_REFRESH_DELAY: Final = 1.5 diff --git a/homeassistant/components/forecast_solar/__init__.py b/homeassistant/components/forecast_solar/__init__.py index 1fd77b9797c..760ad04af98 100644 --- a/homeassistant/components/forecast_solar/__init__.py +++ b/homeassistant/components/forecast_solar/__init__.py @@ -7,7 +7,7 @@ import logging from forecast_solar import ForecastSolar 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 from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.update_coordinator import DataUpdateCoordinator @@ -20,7 +20,7 @@ from .const import ( DOMAIN, ) -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/forked_daapd/__init__.py b/homeassistant/components/forked_daapd/__init__.py index fc67d78d5ed..ea2d678aab5 100644 --- a/homeassistant/components/forked_daapd/__init__.py +++ b/homeassistant/components/forked_daapd/__init__.py @@ -1,9 +1,9 @@ """The forked_daapd component.""" -from homeassistant.components.media_player import DOMAIN as MP_DOMAIN +from homeassistant.const import Platform from .const import DOMAIN, HASS_DATA_REMOVE_LISTENERS_KEY, HASS_DATA_UPDATER_KEY -PLATFORMS = [MP_DOMAIN] +PLATFORMS = [Platform.MEDIA_PLAYER] async def async_setup_entry(hass, entry): diff --git a/homeassistant/components/foscam/__init__.py b/homeassistant/components/foscam/__init__.py index a6714094b0c..2ebea0615f7 100644 --- a/homeassistant/components/foscam/__init__.py +++ b/homeassistant/components/foscam/__init__.py @@ -3,14 +3,20 @@ from libpyfoscam import FoscamCamera from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME +from homeassistant.const import ( + CONF_HOST, + CONF_PASSWORD, + CONF_PORT, + CONF_USERNAME, + Platform, +) from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_registry import async_migrate_entries from .config_flow import DEFAULT_RTSP_PORT from .const import CONF_RTSP_PORT, DOMAIN, LOGGER, SERVICE_PTZ, SERVICE_PTZ_PRESET -PLATFORMS = ["camera"] +PLATFORMS = [Platform.CAMERA] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/freebox/const.py b/homeassistant/components/freebox/const.py index 7183bd029ff..77f36cf44de 100644 --- a/homeassistant/components/freebox/const.py +++ b/homeassistant/components/freebox/const.py @@ -4,7 +4,7 @@ from __future__ import annotations import socket from homeassistant.components.sensor import SensorEntityDescription -from homeassistant.const import DATA_RATE_KILOBYTES_PER_SECOND, PERCENTAGE +from homeassistant.const import DATA_RATE_KILOBYTES_PER_SECOND, PERCENTAGE, Platform DOMAIN = "freebox" SERVICE_REBOOT = "reboot" @@ -17,7 +17,7 @@ APP_DESC = { } API_VERSION = "v6" -PLATFORMS = ["device_tracker", "sensor", "switch"] +PLATFORMS = [Platform.DEVICE_TRACKER, Platform.SENSOR, Platform.SWITCH] DEFAULT_DEVICE_NAME = "Unknown device" diff --git a/homeassistant/components/fritz/const.py b/homeassistant/components/fritz/const.py index d2c26d7bee8..4786ac9097c 100644 --- a/homeassistant/components/fritz/const.py +++ b/homeassistant/components/fritz/const.py @@ -2,9 +2,16 @@ from typing import Literal +from homeassistant.const import Platform + DOMAIN = "fritz" -PLATFORMS = ["binary_sensor", "device_tracker", "sensor", "switch"] +PLATFORMS = [ + Platform.BINARY_SENSOR, + Platform.DEVICE_TRACKER, + Platform.SENSOR, + Platform.SWITCH, +] DATA_FRITZ = "fritz_data" diff --git a/homeassistant/components/fritzbox/const.py b/homeassistant/components/fritzbox/const.py index 9d537bec617..d4827fbb289 100644 --- a/homeassistant/components/fritzbox/const.py +++ b/homeassistant/components/fritzbox/const.py @@ -4,6 +4,8 @@ from __future__ import annotations import logging from typing import Final +from homeassistant.const import Platform + ATTR_STATE_BATTERY_LOW: Final = "battery_low" ATTR_STATE_DEVICE_LOCKED: Final = "device_locked" ATTR_STATE_HOLIDAY_MODE: Final = "holiday_mode" @@ -24,4 +26,10 @@ DOMAIN: Final = "fritzbox" LOGGER: Final[logging.Logger] = logging.getLogger(__package__) -PLATFORMS: Final[list[str]] = ["binary_sensor", "climate", "light", "switch", "sensor"] +PLATFORMS: Final[list[Platform]] = [ + Platform.BINARY_SENSOR, + Platform.CLIMATE, + Platform.LIGHT, + Platform.SWITCH, + Platform.SENSOR, +] diff --git a/homeassistant/components/fritzbox_callmonitor/const.py b/homeassistant/components/fritzbox_callmonitor/const.py index ba0f8d1d973..435bfdef87e 100644 --- a/homeassistant/components/fritzbox_callmonitor/const.py +++ b/homeassistant/components/fritzbox_callmonitor/const.py @@ -1,4 +1,5 @@ """Constants for the AVM Fritz!Box call monitor integration.""" +from homeassistant.const import Platform STATE_RINGING = "ringing" STATE_DIALING = "dialing" @@ -36,6 +37,6 @@ DEFAULT_NAME = "Phone" DOMAIN = "fritzbox_callmonitor" MANUFACTURER = "AVM" -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] UNDO_UPDATE_LISTENER = "undo_update_listener" FRITZBOX_PHONEBOOK = "fritzbox_phonebook" diff --git a/homeassistant/components/fronius/__init__.py b/homeassistant/components/fronius/__init__.py index cf648d3b613..b7699ea7747 100644 --- a/homeassistant/components/fronius/__init__.py +++ b/homeassistant/components/fronius/__init__.py @@ -9,7 +9,7 @@ from typing import TypeVar from pyfronius import Fronius, FroniusError from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_MODEL, ATTR_SW_VERSION, CONF_HOST +from homeassistant.const import ATTR_MODEL, ATTR_SW_VERSION, CONF_HOST, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr @@ -28,7 +28,7 @@ from .coordinator import ( ) _LOGGER = logging.getLogger(__name__) -PLATFORMS: list[str] = ["sensor"] +PLATFORMS: list[Platform] = [Platform.SENSOR] FroniusCoordinatorType = TypeVar("FroniusCoordinatorType", bound=FroniusCoordinatorBase) diff --git a/homeassistant/components/garages_amsterdam/__init__.py b/homeassistant/components/garages_amsterdam/__init__.py index 2077dec741f..5e7fbade8de 100644 --- a/homeassistant/components/garages_amsterdam/__init__.py +++ b/homeassistant/components/garages_amsterdam/__init__.py @@ -6,13 +6,14 @@ import async_timeout import garages_amsterdam from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import aiohttp_client from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import DOMAIN -PLATFORMS = ["binary_sensor", "sensor"] +PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/gdacs/const.py b/homeassistant/components/gdacs/const.py index 5d5c83f013e..551c8be5810 100644 --- a/homeassistant/components/gdacs/const.py +++ b/homeassistant/components/gdacs/const.py @@ -3,9 +3,11 @@ from datetime import timedelta from aio_georss_gdacs.consts import EVENT_TYPE_MAP +from homeassistant.const import Platform + DOMAIN = "gdacs" -PLATFORMS = ("sensor", "geo_location") +PLATFORMS = [Platform.SENSOR, Platform.GEO_LOCATION] FEED = "feed" diff --git a/homeassistant/components/geofency/__init__.py b/homeassistant/components/geofency/__init__.py index 1e8e3eb1f04..1191b72ba3f 100644 --- a/homeassistant/components/geofency/__init__.py +++ b/homeassistant/components/geofency/__init__.py @@ -4,13 +4,13 @@ from http import HTTPStatus from aiohttp import web import voluptuous as vol -from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, STATE_NOT_HOME, + Platform, ) from homeassistant.helpers import config_entry_flow import homeassistant.helpers.config_validation as cv @@ -19,7 +19,7 @@ from homeassistant.util import slugify from .const import DOMAIN -PLATFORMS = [DEVICE_TRACKER] +PLATFORMS = [Platform.DEVICE_TRACKER] CONF_MOBILE_BEACONS = "mobile_beacons" diff --git a/homeassistant/components/geonetnz_quakes/const.py b/homeassistant/components/geonetnz_quakes/const.py index 43818b55f6f..f3303d551ce 100644 --- a/homeassistant/components/geonetnz_quakes/const.py +++ b/homeassistant/components/geonetnz_quakes/const.py @@ -1,9 +1,11 @@ """Define constants for the GeoNet NZ Quakes integration.""" from datetime import timedelta +from homeassistant.const import Platform + DOMAIN = "geonetnz_quakes" -PLATFORMS = ("sensor", "geo_location") +PLATFORMS = [Platform.SENSOR, Platform.GEO_LOCATION] CONF_MINIMUM_MAGNITUDE = "minimum_magnitude" CONF_MMI = "mmi" diff --git a/homeassistant/components/geonetnz_volcano/const.py b/homeassistant/components/geonetnz_volcano/const.py index b70d224a685..3a23084aa1f 100644 --- a/homeassistant/components/geonetnz_volcano/const.py +++ b/homeassistant/components/geonetnz_volcano/const.py @@ -1,6 +1,8 @@ """Define constants for the GeoNet NZ Volcano integration.""" from datetime import timedelta +from homeassistant.const import Platform + DOMAIN = "geonetnz_volcano" FEED = "feed" @@ -15,4 +17,4 @@ DEFAULT_ICON = "mdi:image-filter-hdr" DEFAULT_RADIUS = 50.0 DEFAULT_SCAN_INTERVAL = timedelta(minutes=5) -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] diff --git a/homeassistant/components/gios/__init__.py b/homeassistant/components/gios/__init__.py index 8457f62fd3f..8348fa6567b 100644 --- a/homeassistant/components/gios/__init__.py +++ b/homeassistant/components/gios/__init__.py @@ -11,6 +11,7 @@ from gios import ApiError, Gios, InvalidSensorsData, NoStationError from homeassistant.components.air_quality import DOMAIN as AIR_QUALITY_PLATFORM from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry from homeassistant.helpers.aiohttp_client import async_get_clientsession @@ -21,7 +22,7 @@ from .const import API_TIMEOUT, CONF_STATION_ID, DOMAIN, SCAN_INTERVAL _LOGGER = logging.getLogger(__name__) -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/glances/__init__.py b/homeassistant/components/glances/__init__.py index 464b320dac0..a2f662c4999 100644 --- a/homeassistant/components/glances/__init__.py +++ b/homeassistant/components/glances/__init__.py @@ -15,6 +15,7 @@ from homeassistant.const import ( CONF_SSL, CONF_USERNAME, CONF_VERIFY_SSL, + Platform, ) from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady @@ -37,7 +38,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] GLANCES_SCHEMA = vol.All( vol.Schema( diff --git a/homeassistant/components/goalzero/__init__.py b/homeassistant/components/goalzero/__init__.py index e03aa25f8f9..6e527adb485 100644 --- a/homeassistant/components/goalzero/__init__.py +++ b/homeassistant/components/goalzero/__init__.py @@ -5,11 +5,14 @@ import logging from goalzero import Yeti, exceptions -from homeassistant.components.binary_sensor import DOMAIN as DOMAIN_BINARY_SENSOR -from homeassistant.components.sensor import DOMAIN as DOMAIN_SENSOR -from homeassistant.components.switch import DOMAIN as DOMAIN_SWITCH from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_ATTRIBUTION, ATTR_MODEL, CONF_HOST, CONF_NAME +from homeassistant.const import ( + ATTR_ATTRIBUTION, + ATTR_MODEL, + CONF_HOST, + CONF_NAME, + Platform, +) from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr @@ -33,7 +36,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -PLATFORMS = [DOMAIN_BINARY_SENSOR, DOMAIN_SENSOR, DOMAIN_SWITCH] +PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR, Platform.SWITCH] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/gogogate2/__init__.py b/homeassistant/components/gogogate2/__init__.py index f4ff18b0837..7dccd5551c7 100644 --- a/homeassistant/components/gogogate2/__init__.py +++ b/homeassistant/components/gogogate2/__init__.py @@ -1,15 +1,13 @@ """The gogogate2 component.""" -from homeassistant.components.cover import DOMAIN as COVER -from homeassistant.components.sensor import DOMAIN as SENSOR 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 .common import get_data_update_coordinator from .const import DEVICE_TYPE_GOGOGATE2 -PLATFORMS = [COVER, SENSOR] +PLATFORMS = [Platform.COVER, Platform.SENSOR] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/google_travel_time/__init__.py b/homeassistant/components/google_travel_time/__init__.py index 7ac88b84727..1bc1c285bee 100644 --- a/homeassistant/components/google_travel_time/__init__.py +++ b/homeassistant/components/google_travel_time/__init__.py @@ -2,13 +2,14 @@ import logging from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_registry import ( async_entries_for_config_entry, async_get, ) -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/gpslogger/__init__.py b/homeassistant/components/gpslogger/__init__.py index 715119448b5..ebbac36659f 100644 --- a/homeassistant/components/gpslogger/__init__.py +++ b/homeassistant/components/gpslogger/__init__.py @@ -4,11 +4,8 @@ from http import HTTPStatus from aiohttp import web import voluptuous as vol -from homeassistant.components.device_tracker import ( - ATTR_BATTERY, - DOMAIN as DEVICE_TRACKER, -) -from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CONF_WEBHOOK_ID +from homeassistant.components.device_tracker import ATTR_BATTERY +from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CONF_WEBHOOK_ID, Platform from homeassistant.helpers import config_entry_flow import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send @@ -24,7 +21,7 @@ from .const import ( DOMAIN, ) -PLATFORMS = [DEVICE_TRACKER] +PLATFORMS = [Platform.DEVICE_TRACKER] TRACKER_UPDATE = f"{DOMAIN}_tracker_update" diff --git a/homeassistant/components/gree/__init__.py b/homeassistant/components/gree/__init__.py index 761c8e0ab78..fa51a48bb4f 100644 --- a/homeassistant/components/gree/__init__.py +++ b/homeassistant/components/gree/__init__.py @@ -2,9 +2,8 @@ from datetime import timedelta import logging -from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN -from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.config_entries import ConfigEntry +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.event import async_track_time_interval @@ -20,7 +19,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -PLATFORMS = [CLIMATE_DOMAIN, SWITCH_DOMAIN] +PLATFORMS = [Platform.CLIMATE, Platform.SWITCH] async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: diff --git a/homeassistant/components/growatt_server/const.py b/homeassistant/components/growatt_server/const.py index 5425e26c806..4fcc4887843 100644 --- a/homeassistant/components/growatt_server/const.py +++ b/homeassistant/components/growatt_server/const.py @@ -1,4 +1,6 @@ """Define constants for the Growatt Server component.""" +from homeassistant.const import Platform + CONF_PLANT_ID = "plant_id" DEFAULT_PLANT_ID = "0" @@ -15,6 +17,6 @@ DEFAULT_URL = SERVER_URLS[0] DOMAIN = "growatt_server" -PLATFORMS = ["sensor"] +PLATFORMS = [Platform.SENSOR] LOGIN_INVALID_AUTH_CODE = "502" diff --git a/homeassistant/components/guardian/__init__.py b/homeassistant/components/guardian/__init__.py index 892080b9afe..7f0834faff5 100644 --- a/homeassistant/components/guardian/__init__.py +++ b/homeassistant/components/guardian/__init__.py @@ -16,6 +16,7 @@ from homeassistant.const import ( CONF_IP_ADDRESS, CONF_PORT, CONF_URL, + Platform, ) from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import config_validation as cv, device_registry as dr @@ -80,7 +81,7 @@ SERVICE_UPGRADE_FIRMWARE_SCHEMA = vol.Schema( ) -PLATFORMS = ["binary_sensor", "sensor", "switch"] +PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR, Platform.SWITCH] @callback