mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use Platform enum in load_platform [m-z] (#63751)
This commit is contained in:
parent
1305affda0
commit
24314f1b11
@ -7,7 +7,7 @@ import time
|
|||||||
from maxcube.cube import MaxCube
|
from maxcube.cube import MaxCube
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL
|
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.discovery import load_platform
|
from homeassistant.helpers.discovery import load_platform
|
||||||
@ -76,8 +76,8 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
if connection_failed >= len(gateways):
|
if connection_failed >= len(gateways):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
load_platform(hass, "climate", DOMAIN, {}, config)
|
load_platform(hass, Platform.CLIMATE, DOMAIN, {}, config)
|
||||||
load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import melissa
|
import melissa
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
@ -34,5 +34,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
await api.async_connect()
|
await api.async_connect()
|
||||||
hass.data[DATA_MELISSA] = api
|
hass.data[DATA_MELISSA] = api
|
||||||
|
|
||||||
hass.async_create_task(async_load_platform(hass, "climate", DOMAIN, {}, config))
|
hass.async_create_task(
|
||||||
|
async_load_platform(hass, Platform.CLIMATE, DOMAIN, {}, config)
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
|
@ -61,7 +61,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(hass, "notify", DOMAIN, {}, config)
|
discovery.async_load_platform(hass, Platform.NOTIFY, DOMAIN, {}, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
websocket_api.async_setup_commands(hass)
|
websocket_api.async_setup_commands(hass)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for Mycroft AI."""
|
"""Support for Mycroft AI."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -17,5 +17,5 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Mycroft component."""
|
"""Set up the Mycroft component."""
|
||||||
hass.data[DOMAIN] = config[DOMAIN][CONF_HOST]
|
hass.data[DOMAIN] = config[DOMAIN][CONF_HOST]
|
||||||
discovery.load_platform(hass, "notify", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.NOTIFY, DOMAIN, {}, config)
|
||||||
return True
|
return True
|
||||||
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
@ -111,10 +112,12 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _close)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _close)
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(hass, "binary_sensor", DOMAIN, {CONF_ZONES: zones}, config)
|
async_load_platform(
|
||||||
|
hass, Platform.BINARY_SENSOR, DOMAIN, {CONF_ZONES: zones}, config
|
||||||
|
)
|
||||||
)
|
)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(hass, "alarm_control_panel", DOMAIN, {}, config)
|
async_load_platform(hass, Platform.ALARM_CONTROL_PANEL, DOMAIN, {}, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_zone_change(zone_id: int, state: bool):
|
def on_zone_change(zone_id: int, state: bool):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The notify_events component."""
|
"""The notify_events component."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_TOKEN
|
from homeassistant.const import CONF_TOKEN, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -18,5 +18,5 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
"""Set up the notify_events component."""
|
"""Set up the notify_events component."""
|
||||||
|
|
||||||
hass.data[DOMAIN] = config[DOMAIN]
|
hass.data[DOMAIN] = config[DOMAIN]
|
||||||
discovery.load_platform(hass, "notify", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.NOTIFY, DOMAIN, {}, config)
|
||||||
return True
|
return True
|
||||||
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -161,9 +162,9 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
|
|
||||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, prepare_gpio)
|
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, prepare_gpio)
|
||||||
|
|
||||||
load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
load_platform(hass, "sensor", DOMAIN, {}, config)
|
load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||||
load_platform(hass, "switch", DOMAIN, {}, config)
|
load_platform(hass, Platform.SWITCH, DOMAIN, {}, config)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ from homeassistant.const import (
|
|||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -151,6 +152,6 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
submit_tv_request,
|
submit_tv_request,
|
||||||
schema=SUBMIT_TV_REQUEST_SERVICE_SCHEMA,
|
schema=SUBMIT_TV_REQUEST_SERVICE_SCHEMA,
|
||||||
)
|
)
|
||||||
hass.helpers.discovery.load_platform("sensor", DOMAIN, {}, config)
|
hass.helpers.discovery.load_platform(Platform.SENSOR, DOMAIN, {}, config)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -5,7 +5,7 @@ from pyopnsense import diagnostics
|
|||||||
from pyopnsense.exceptions import APIException
|
from pyopnsense.exceptions import APIException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_URL, CONF_VERIFY_SSL
|
from homeassistant.const import CONF_API_KEY, CONF_URL, CONF_VERIFY_SSL, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.discovery import load_platform
|
from homeassistant.helpers.discovery import load_platform
|
||||||
@ -75,5 +75,5 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
CONF_TRACKER_INTERFACE: tracker_interfaces,
|
CONF_TRACKER_INTERFACE: tracker_interfaces,
|
||||||
}
|
}
|
||||||
|
|
||||||
load_platform(hass, "device_tracker", DOMAIN, tracker_interfaces, config)
|
load_platform(hass, Platform.DEVICE_TRACKER, DOMAIN, tracker_interfaces, config)
|
||||||
return True
|
return True
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The rpi_camera component."""
|
"""The rpi_camera component."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
|
from homeassistant.const import CONF_FILE_PATH, CONF_NAME, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
from homeassistant.helpers import config_validation as cv, discovery
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
@ -82,6 +82,6 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
CONF_VERTICAL_FLIP: config_domain.get(CONF_VERTICAL_FLIP),
|
CONF_VERTICAL_FLIP: config_domain.get(CONF_VERTICAL_FLIP),
|
||||||
}
|
}
|
||||||
|
|
||||||
discovery.load_platform(hass, "camera", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.CAMERA, DOMAIN, {}, config)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -21,6 +21,7 @@ from homeassistant.const import (
|
|||||||
DATA_GIGABYTES,
|
DATA_GIGABYTES,
|
||||||
DATA_MEGABYTES,
|
DATA_MEGABYTES,
|
||||||
DATA_RATE_MEGABYTES_PER_SECOND,
|
DATA_RATE_MEGABYTES_PER_SECOND,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import ServiceCall, callback
|
from homeassistant.core import ServiceCall, callback
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
@ -222,7 +223,7 @@ def async_setup_sabnzbd(hass, sab_api, config, name):
|
|||||||
if config.get(CONF_SENSORS):
|
if config.get(CONF_SENSORS):
|
||||||
hass.data[DATA_SABNZBD] = sab_api_data
|
hass.data[DATA_SABNZBD] = sab_api_data
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(hass, "sensor", DOMAIN, {}, config)
|
discovery.async_load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_service_handler(service: ServiceCall) -> None:
|
async def async_service_handler(service: ServiceCall) -> None:
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
from satel_integra.satel_integra import AsyncSatel
|
from satel_integra.satel_integra import AsyncSatel
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP, Platform
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
@ -124,13 +124,13 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
_LOGGER.debug("Arm home config: %s, mode: %s ", conf, conf.get(CONF_ARM_HOME_MODE))
|
_LOGGER.debug("Arm home config: %s, mode: %s ", conf, conf.get(CONF_ARM_HOME_MODE))
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(hass, "alarm_control_panel", DOMAIN, conf, config)
|
async_load_platform(hass, Platform.ALARM_CONTROL_PANEL, DOMAIN, conf, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(
|
async_load_platform(
|
||||||
hass,
|
hass,
|
||||||
"binary_sensor",
|
Platform.BINARY_SENSOR,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
{CONF_ZONES: zones, CONF_OUTPUTS: outputs},
|
{CONF_ZONES: zones, CONF_OUTPUTS: outputs},
|
||||||
config,
|
config,
|
||||||
@ -140,7 +140,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(
|
async_load_platform(
|
||||||
hass,
|
hass,
|
||||||
"switch",
|
Platform.SWITCH,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
{
|
{
|
||||||
CONF_SWITCHABLE_OUTPUTS: switchable_outputs,
|
CONF_SWITCHABLE_OUTPUTS: switchable_outputs,
|
||||||
|
@ -6,7 +6,7 @@ from schluter.api import Api
|
|||||||
from schluter.authenticator import AuthenticationState, Authenticator
|
from schluter.authenticator import AuthenticationState, Authenticator
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -62,7 +62,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
DATA_SCHLUTER_API: api,
|
DATA_SCHLUTER_API: api,
|
||||||
DATA_SCHLUTER_SESSION: authentication.session_id,
|
DATA_SCHLUTER_SESSION: authentication.session_id,
|
||||||
}
|
}
|
||||||
discovery.load_platform(hass, "climate", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.CLIMATE, DOMAIN, {}, config)
|
||||||
return True
|
return True
|
||||||
if state == AuthenticationState.BAD_PASSWORD:
|
if state == AuthenticationState.BAD_PASSWORD:
|
||||||
_LOGGER.error("Invalid password provided")
|
_LOGGER.error("Invalid password provided")
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
from sisyphus_control import Table
|
from sisyphus_control import Table
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -51,10 +51,12 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
tables[host] = TableHolder(hass, session, host, name)
|
tables[host] = TableHolder(hass, session, host, name)
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(hass, "light", DOMAIN, {CONF_HOST: host}, config)
|
async_load_platform(hass, Platform.LIGHT, DOMAIN, {CONF_HOST: host}, config)
|
||||||
)
|
)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(hass, "media_player", DOMAIN, {CONF_HOST: host}, config)
|
async_load_platform(
|
||||||
|
hass, Platform.MEDIA_PLAYER, DOMAIN, {CONF_HOST: host}, config
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if isinstance(table_configs, dict): # AUTODETECT_SCHEMA
|
if isinstance(table_configs, dict): # AUTODETECT_SCHEMA
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
from sleepyq import Sleepyq
|
from sleepyq import Sleepyq
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -52,8 +52,8 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
hass.data[DOMAIN] = data
|
hass.data[DOMAIN] = data
|
||||||
discovery.load_platform(hass, "sensor", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||||
discovery.load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import logging
|
|||||||
from pysmarty import Smarty
|
from pysmarty import Smarty
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -54,9 +54,9 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
smarty.update()
|
smarty.update()
|
||||||
|
|
||||||
# Load platforms
|
# Load platforms
|
||||||
discovery.load_platform(hass, "fan", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.FAN, DOMAIN, {}, config)
|
||||||
discovery.load_platform(hass, "sensor", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||||
discovery.load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
|
|
||||||
def poll_device_update(event_time):
|
def poll_device_update(event_time):
|
||||||
"""Update Smarty device."""
|
"""Update Smarty device."""
|
||||||
|
@ -6,6 +6,7 @@ from pyspcwebgw.area import Area
|
|||||||
from pyspcwebgw.zone import Zone
|
from pyspcwebgw.zone import Zone
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import aiohttp_client, discovery
|
from homeassistant.helpers import aiohttp_client, discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -64,12 +65,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
|
|
||||||
# add sensor devices for each zone (typically motion/fire/door sensors)
|
# add sensor devices for each zone (typically motion/fire/door sensors)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
discovery.async_load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
# create a separate alarm panel for each area
|
# create a separate alarm panel for each area
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(hass, "alarm_control_panel", DOMAIN, {}, config)
|
discovery.async_load_platform(
|
||||||
|
hass, Platform.ALARM_CONTROL_PANEL, DOMAIN, {}, config
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# start listening for incoming events over websocket
|
# start listening for incoming events over websocket
|
||||||
|
@ -6,7 +6,7 @@ from pystiebeleltron import pystiebeleltron
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.modbus.const import CONF_HUB, DEFAULT_HUB, MODBUS_DOMAIN
|
from homeassistant.components.modbus.const import CONF_HUB, DEFAULT_HUB, MODBUS_DOMAIN
|
||||||
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
|
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -45,7 +45,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
"ste_data": StiebelEltronData(name, modbus_client),
|
"ste_data": StiebelEltronData(name, modbus_client),
|
||||||
}
|
}
|
||||||
|
|
||||||
discovery.load_platform(hass, "climate", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.CLIMATE, DOMAIN, {}, config)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
# have to use discovery to load platform.
|
# have to use discovery to load platform.
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(
|
discovery.async_load_platform(
|
||||||
hass, "notify", DOMAIN, {CONF_NAME: DOMAIN}, hass.data[DATA_HASS_CONFIG]
|
hass,
|
||||||
|
Platform.NOTIFY,
|
||||||
|
DOMAIN,
|
||||||
|
{CONF_NAME: DOMAIN},
|
||||||
|
hass.data[DATA_HASS_CONFIG],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_RECIPIENT,
|
CONF_RECIPIENT,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
from homeassistant.helpers import config_validation as cv, discovery
|
||||||
@ -99,7 +100,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
for notify_conf in conf.get(CONF_NOTIFY, []):
|
for notify_conf in conf.get(CONF_NOTIFY, []):
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(
|
discovery.async_load_platform(
|
||||||
hass, "notify", DOMAIN, notify_conf, config
|
hass, Platform.NOTIFY, DOMAIN, notify_conf, config
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import async_timeout
|
|||||||
from awesomeversion import AwesomeVersion
|
from awesomeversion import AwesomeVersion
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import __version__ as current_version
|
from homeassistant.const import Platform, __version__ as current_version
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery, update_coordinator
|
from homeassistant.helpers import discovery, update_coordinator
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
@ -117,7 +117,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
asyncio.create_task(coordinator.async_refresh())
|
asyncio.create_task(coordinator.async_refresh())
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
discovery.async_load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
discovery.async_load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -7,7 +7,12 @@ import time
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from waterfurnace.waterfurnace import WaterFurnace, WFCredentialError, WFException
|
from waterfurnace.waterfurnace import WaterFurnace, WFCredentialError, WFException
|
||||||
|
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import (
|
||||||
|
CONF_PASSWORD,
|
||||||
|
CONF_USERNAME,
|
||||||
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
Platform,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
from homeassistant.helpers import config_validation as cv, discovery
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
@ -56,7 +61,7 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool:
|
|||||||
hass.data[DOMAIN] = WaterFurnaceData(hass, wfconn)
|
hass.data[DOMAIN] = WaterFurnaceData(hass, wfconn)
|
||||||
hass.data[DOMAIN].start()
|
hass.data[DOMAIN].start()
|
||||||
|
|
||||||
discovery.load_platform(hass, "sensor", DOMAIN, {}, config)
|
discovery.load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -177,10 +178,14 @@ async def async_setup_tv_finalize(hass, config, conf, client):
|
|||||||
|
|
||||||
await async_connect(client)
|
await async_connect(client)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.helpers.discovery.async_load_platform("media_player", DOMAIN, conf, config)
|
hass.helpers.discovery.async_load_platform(
|
||||||
|
Platform.MEDIA_PLAYER, DOMAIN, conf, config
|
||||||
|
)
|
||||||
)
|
)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.helpers.discovery.async_load_platform("notify", DOMAIN, conf, config)
|
hass.helpers.discovery.async_load_platform(
|
||||||
|
Platform.NOTIFY, DOMAIN, conf, config
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""The zodiac component."""
|
"""The zodiac component."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
@ -15,6 +16,8 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the zodiac component."""
|
"""Set up the zodiac component."""
|
||||||
hass.async_create_task(async_load_platform(hass, "sensor", DOMAIN, {}, config))
|
hass.async_create_task(
|
||||||
|
async_load_platform(hass, Platform.SENSOR, DOMAIN, {}, config)
|
||||||
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
CONF_VERIFY_SSL,
|
CONF_VERIFY_SSL,
|
||||||
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -94,7 +95,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
async_load_platform(hass, "binary_sensor", DOMAIN, {}, config)
|
async_load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
return success
|
return success
|
||||||
|
Loading…
x
Reference in New Issue
Block a user