mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Use Platform enum (#76967)
This commit is contained in:
parent
82b6deeb79
commit
4a84a8caa9
@ -1,4 +1,6 @@
|
|||||||
"""The bayesian component."""
|
"""The bayesian component."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "bayesian"
|
DOMAIN = "bayesian"
|
||||||
PLATFORMS = ["binary_sensor"]
|
PLATFORMS = [Platform.BINARY_SENSOR]
|
||||||
|
@ -29,6 +29,7 @@ from homeassistant.const import (
|
|||||||
CONF_ENTITIES,
|
CONF_ENTITIES,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_OFFSET,
|
CONF_OFFSET,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.exceptions import (
|
from homeassistant.exceptions import (
|
||||||
@ -88,7 +89,7 @@ YAML_DEVICES = f"{DOMAIN}_calendars.yaml"
|
|||||||
|
|
||||||
TOKEN_FILE = f".{DOMAIN}.token"
|
TOKEN_FILE = f".{DOMAIN}.token"
|
||||||
|
|
||||||
PLATFORMS = ["calendar"]
|
PLATFORMS = [Platform.CALENDAR]
|
||||||
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""Tracks devices by sending a ICMP echo request (ping)."""
|
"""Tracks devices by sending a ICMP echo request (ping)."""
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
# The ping binary and icmplib timeouts are not the same
|
# The ping binary and icmplib timeouts are not the same
|
||||||
# timeout. ping is an overall timeout, icmplib is the
|
# timeout. ping is an overall timeout, icmplib is the
|
||||||
# time since the data was sent.
|
# time since the data was sent.
|
||||||
@ -13,6 +15,6 @@ ICMP_TIMEOUT = 1
|
|||||||
PING_ATTEMPTS_COUNT = 3
|
PING_ATTEMPTS_COUNT = 3
|
||||||
|
|
||||||
DOMAIN = "ping"
|
DOMAIN = "ping"
|
||||||
PLATFORMS = ["binary_sensor"]
|
PLATFORMS = [Platform.BINARY_SENSOR]
|
||||||
|
|
||||||
PING_PRIVS = "ping_privs"
|
PING_PRIVS = "ping_privs"
|
||||||
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
||||||
@ -47,7 +48,7 @@ from .const import (
|
|||||||
from .sab import get_client
|
from .sab import get_client
|
||||||
from .sensor import OLD_SENSOR_KEYS
|
from .sensor import OLD_SENSOR_KEYS
|
||||||
|
|
||||||
PLATFORMS = ["sensor"]
|
PLATFORMS = [Platform.SENSOR]
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SERVICES = (
|
SERVICES = (
|
||||||
|
@ -4,13 +4,13 @@ from __future__ import annotations
|
|||||||
from aioslimproto import SlimServer
|
from aioslimproto import SlimServer
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
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.core import Event, HomeAssistant
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
PLATFORMS = ["media_player"]
|
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
"""Const for Sonos."""
|
"""Const for Sonos."""
|
||||||
import datetime
|
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 (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_CLASS_ALBUM,
|
MEDIA_CLASS_ALBUM,
|
||||||
MEDIA_CLASS_ARTIST,
|
MEDIA_CLASS_ARTIST,
|
||||||
@ -19,22 +17,20 @@ from homeassistant.components.media_player.const import (
|
|||||||
MEDIA_TYPE_PLAYLIST,
|
MEDIA_TYPE_PLAYLIST,
|
||||||
MEDIA_TYPE_TRACK,
|
MEDIA_TYPE_TRACK,
|
||||||
)
|
)
|
||||||
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN
|
from homeassistant.const import Platform
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
|
||||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
|
||||||
|
|
||||||
UPNP_ST = "urn:schemas-upnp-org:device:ZonePlayer:1"
|
UPNP_ST = "urn:schemas-upnp-org:device:ZonePlayer:1"
|
||||||
|
|
||||||
DOMAIN = "sonos"
|
DOMAIN = "sonos"
|
||||||
DATA_SONOS = "sonos_media_player"
|
DATA_SONOS = "sonos_media_player"
|
||||||
DATA_SONOS_DISCOVERY_MANAGER = "sonos_discovery_manager"
|
DATA_SONOS_DISCOVERY_MANAGER = "sonos_discovery_manager"
|
||||||
PLATFORMS = {
|
PLATFORMS = [
|
||||||
BINARY_SENSOR_DOMAIN,
|
Platform.BINARY_SENSOR,
|
||||||
MP_DOMAIN,
|
Platform.MEDIA_PLAYER,
|
||||||
NUMBER_DOMAIN,
|
Platform.NUMBER,
|
||||||
SENSOR_DOMAIN,
|
Platform.SENSOR,
|
||||||
SWITCH_DOMAIN,
|
Platform.SWITCH,
|
||||||
}
|
]
|
||||||
|
|
||||||
SONOS_ARTIST = "artists"
|
SONOS_ARTIST = "artists"
|
||||||
SONOS_ALBUM = "albums"
|
SONOS_ALBUM = "albums"
|
||||||
|
@ -4,13 +4,14 @@ from aiohttp import ClientConnectorError
|
|||||||
from vulcan import Account, Keystore, UnauthorizedCertificateException, Vulcan
|
from vulcan import Account, Keystore, UnauthorizedCertificateException, Vulcan
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
PLATFORMS = ["calendar"]
|
PLATFORMS = [Platform.CALENDAR]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
@ -4,8 +4,10 @@ import asyncio
|
|||||||
from aiowebostv import WebOsTvCommandError
|
from aiowebostv import WebOsTvCommandError
|
||||||
from websockets.exceptions import ConnectionClosed, ConnectionClosedOK
|
from websockets.exceptions import ConnectionClosed, ConnectionClosedOK
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
|
||||||
DOMAIN = "webostv"
|
DOMAIN = "webostv"
|
||||||
PLATFORMS = ["media_player"]
|
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||||
DATA_CONFIG_ENTRY = "config_entry"
|
DATA_CONFIG_ENTRY = "config_entry"
|
||||||
DATA_HASS_CONFIG = "hass_config"
|
DATA_HASS_CONFIG = "hass_config"
|
||||||
DEFAULT_NAME = "LG webOS Smart TV"
|
DEFAULT_NAME = "LG webOS Smart TV"
|
||||||
|
@ -6,7 +6,7 @@ import logging
|
|||||||
from pyws66i import WS66i, get_ws66i
|
from pyws66i import WS66i, get_ws66i
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
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.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ from .models import SourceRep, Ws66iData
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
PLATFORMS = ["media_player"]
|
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user