Use Platform enum (#76967)

This commit is contained in:
epenet 2022-08-18 10:22:49 +02:00 committed by GitHub
parent 82b6deeb79
commit 4a84a8caa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 22 deletions

View File

@ -1,4 +1,6 @@
"""The bayesian component."""
from homeassistant.const import Platform
DOMAIN = "bayesian"
PLATFORMS = ["binary_sensor"]
PLATFORMS = [Platform.BINARY_SENSOR]

View File

@ -29,6 +29,7 @@ from homeassistant.const import (
CONF_ENTITIES,
CONF_NAME,
CONF_OFFSET,
Platform,
)
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.exceptions import (
@ -88,7 +89,7 @@ YAML_DEVICES = f"{DOMAIN}_calendars.yaml"
TOKEN_FILE = f".{DOMAIN}.token"
PLATFORMS = ["calendar"]
PLATFORMS = [Platform.CALENDAR]
CONFIG_SCHEMA = vol.Schema(

View File

@ -1,5 +1,7 @@
"""Tracks devices by sending a ICMP echo request (ping)."""
from homeassistant.const import Platform
# The ping binary and icmplib timeouts are not the same
# timeout. ping is an overall timeout, icmplib is the
# time since the data was sent.
@ -13,6 +15,6 @@ ICMP_TIMEOUT = 1
PING_ATTEMPTS_COUNT = 3
DOMAIN = "ping"
PLATFORMS = ["binary_sensor"]
PLATFORMS = [Platform.BINARY_SENSOR]
PING_PRIVS = "ping_privs"

View File

@ -16,6 +16,7 @@ from homeassistant.const import (
CONF_PORT,
CONF_SENSORS,
CONF_SSL,
Platform,
)
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
@ -47,7 +48,7 @@ from .const import (
from .sab import get_client
from .sensor import OLD_SENSOR_KEYS
PLATFORMS = ["sensor"]
PLATFORMS = [Platform.SENSOR]
_LOGGER = logging.getLogger(__name__)
SERVICES = (

View File

@ -4,13 +4,13 @@ from __future__ import annotations
from aioslimproto import SlimServer
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, Platform
from homeassistant.core import Event, HomeAssistant
from homeassistant.helpers import device_registry as dr
from .const import DOMAIN
PLATFORMS = ["media_player"]
PLATFORMS = [Platform.MEDIA_PLAYER]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -1,8 +1,6 @@
"""Const for Sonos."""
import datetime
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
from homeassistant.components.media_player.const import (
MEDIA_CLASS_ALBUM,
MEDIA_CLASS_ARTIST,
@ -19,22 +17,20 @@ from homeassistant.components.media_player.const import (
MEDIA_TYPE_PLAYLIST,
MEDIA_TYPE_TRACK,
)
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.const import Platform
UPNP_ST = "urn:schemas-upnp-org:device:ZonePlayer:1"
DOMAIN = "sonos"
DATA_SONOS = "sonos_media_player"
DATA_SONOS_DISCOVERY_MANAGER = "sonos_discovery_manager"
PLATFORMS = {
BINARY_SENSOR_DOMAIN,
MP_DOMAIN,
NUMBER_DOMAIN,
SENSOR_DOMAIN,
SWITCH_DOMAIN,
}
PLATFORMS = [
Platform.BINARY_SENSOR,
Platform.MEDIA_PLAYER,
Platform.NUMBER,
Platform.SENSOR,
Platform.SWITCH,
]
SONOS_ARTIST = "artists"
SONOS_ALBUM = "albums"

View File

@ -4,13 +4,14 @@ from aiohttp import ClientConnectorError
from vulcan import Account, Keystore, UnauthorizedCertificateException, Vulcan
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import DOMAIN
PLATFORMS = ["calendar"]
PLATFORMS = [Platform.CALENDAR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

View File

@ -4,8 +4,10 @@ import asyncio
from aiowebostv import WebOsTvCommandError
from websockets.exceptions import ConnectionClosed, ConnectionClosedOK
from homeassistant.const import Platform
DOMAIN = "webostv"
PLATFORMS = ["media_player"]
PLATFORMS = [Platform.MEDIA_PLAYER]
DATA_CONFIG_ENTRY = "config_entry"
DATA_HASS_CONFIG = "hass_config"
DEFAULT_NAME = "LG webOS Smart TV"

View File

@ -6,7 +6,7 @@ import logging
from pyws66i import WS66i, get_ws66i
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_IP_ADDRESS, EVENT_HOMEASSISTANT_STOP
from homeassistant.const import CONF_IP_ADDRESS, EVENT_HOMEASSISTANT_STOP, Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
@ -16,7 +16,7 @@ from .models import SourceRep, Ws66iData
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["media_player"]
PLATFORMS = [Platform.MEDIA_PLAYER]
@callback