mirror of
https://github.com/home-assistant/core
synced 2024-08-02 23:40:32 +02:00
Use platform enum (2) [E-G] (#60933)
This commit is contained in:
parent
79cd281c48
commit
cd1b923e16
@ -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"
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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(
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
]
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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,
|
||||
]
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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]
|
||||
|
@ -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:
|
||||
|
@ -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(
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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__)
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user