mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Add init type hints [h-j] (#63187)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
00ec874389
commit
1650332188
@ -8,8 +8,11 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
|
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_IP_ADDRESS, Platform
|
from homeassistant.const import CONF_IP_ADDRESS, Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
@ -45,7 +48,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Hisense AEH-W4A1 integration."""
|
"""Set up the Hisense AEH-W4A1 integration."""
|
||||||
conf = config.get(DOMAIN)
|
conf = config.get(DOMAIN)
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
@ -70,12 +73,12 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up a config entry for Hisense AEH-W4A1."""
|
"""Set up a config entry for Hisense AEH-W4A1."""
|
||||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -8,7 +8,9 @@ from apyhiveapi.helper.hive_exceptions import HiveReauthRequired
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import (
|
from homeassistant.helpers.dispatcher import (
|
||||||
@ -16,6 +18,7 @@ from homeassistant.helpers.dispatcher import (
|
|||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import DOMAIN, PLATFORM_LOOKUP, PLATFORMS
|
from .const import DOMAIN, PLATFORM_LOOKUP, PLATFORMS
|
||||||
|
|
||||||
@ -38,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Hive configuration setup."""
|
"""Hive configuration setup."""
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
|
|
||||||
@ -61,7 +64,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Hive from a config entry."""
|
"""Set up Hive from a config entry."""
|
||||||
|
|
||||||
websession = aiohttp_client.async_get_clientsession(hass)
|
websession = aiohttp_client.async_get_clientsession(hass)
|
||||||
@ -92,7 +95,7 @@ async def async_setup_entry(hass, entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
if unload_ok:
|
if unload_ok:
|
||||||
|
@ -4,15 +4,16 @@ import logging
|
|||||||
from hlk_sw16 import create_hlk_sw16_connection
|
from hlk_sw16 import create_hlk_sw16_connection
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_SWITCHES, Platform
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_SWITCHES, Platform
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import (
|
from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONNECTION_TIMEOUT,
|
CONNECTION_TIMEOUT,
|
||||||
@ -55,7 +56,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Component setup, do nothing."""
|
"""Component setup, do nothing."""
|
||||||
if DOMAIN not in config:
|
if DOMAIN not in config:
|
||||||
return True
|
return True
|
||||||
@ -72,7 +73,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up the HLK-SW16 switch."""
|
"""Set up the HLK-SW16 switch."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
host = entry.data[CONF_HOST]
|
host = entry.data[CONF_HOST]
|
||||||
@ -122,7 +123,7 @@ async def async_setup_entry(hass, entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
client = hass.data[DOMAIN][entry.entry_id].pop(DATA_DEVICE_REGISTER)
|
client = hass.data[DOMAIN][entry.entry_id].pop(DATA_DEVICE_REGISTER)
|
||||||
client.stop()
|
client.stop()
|
||||||
|
@ -338,7 +338,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Remove a config entry."""
|
"""Remove a config entry."""
|
||||||
return await hass.async_add_executor_job(
|
return await hass.async_add_executor_job(
|
||||||
remove_state_files_for_entry_id, hass, entry.entry_id
|
remove_state_files_for_entry_id, hass, entry.entry_id
|
||||||
|
@ -22,9 +22,10 @@ from homeassistant.const import (
|
|||||||
CONF_VERIFY_SSL,
|
CONF_VERIFY_SSL,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.core import ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_ADDRESS,
|
ATTR_ADDRESS,
|
||||||
@ -208,7 +209,7 @@ SCHEMA_SERVICE_PUT_PARAMSET = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Homematic component."""
|
"""Set up the Homematic component."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
hass.data[DATA_CONF] = remotes = {}
|
hass.data[DATA_CONF] = remotes = {}
|
||||||
|
@ -4,7 +4,9 @@ from datetime import timedelta
|
|||||||
|
|
||||||
import somecomfort
|
import somecomfort
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300)
|
|||||||
PLATFORMS = [Platform.CLIMATE]
|
PLATFORMS = [Platform.CLIMATE]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config):
|
async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
||||||
"""Set up the Honeywell thermostat."""
|
"""Set up the Honeywell thermostat."""
|
||||||
username = config.data[CONF_USERNAME]
|
username = config.data[CONF_USERNAME]
|
||||||
password = config.data[CONF_PASSWORD]
|
password = config.data[CONF_PASSWORD]
|
||||||
@ -58,7 +60,7 @@ async def update_listener(hass, config) -> None:
|
|||||||
await hass.config_entries.async_reload(config.entry_id)
|
await hass.config_entries.async_reload(config.entry_id)
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, config):
|
async def async_unload_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
||||||
"""Unload the config config and platforms."""
|
"""Unload the config config and platforms."""
|
||||||
unload_ok = await hass.config_entries.async_unload_platforms(config, PLATFORMS)
|
unload_ok = await hass.config_entries.async_unload_platforms(config, PLATFORMS)
|
||||||
if unload_ok:
|
if unload_ok:
|
||||||
|
@ -7,11 +7,12 @@ from requests.exceptions import ConnectTimeout, HTTPError
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ACCESS_TOKEN, CONF_SCAN_INTERVAL
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ACCESS_TOKEN, CONF_SCAN_INTERVAL
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||||
from homeassistant.helpers.event import track_time_interval
|
from homeassistant.helpers.event import track_time_interval
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Hunter Hydrawise component."""
|
"""Set up the Hunter Hydrawise component."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
access_token = conf[CONF_ACCESS_TOKEN]
|
access_token = conf[CONF_ACCESS_TOKEN]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""The iCloud component."""
|
"""The iCloud component."""
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
|
@ -7,10 +7,12 @@ import pyfttt
|
|||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_WEBHOOK_ID
|
from homeassistant.const import CONF_WEBHOOK_ID
|
||||||
from homeassistant.core import ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.helpers import config_entry_flow
|
from homeassistant.helpers import config_entry_flow
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the IFTTT service component."""
|
"""Set up the IFTTT service component."""
|
||||||
if DOMAIN not in config:
|
if DOMAIN not in config:
|
||||||
return True
|
return True
|
||||||
@ -111,7 +113,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
hass.bus.async_fire(EVENT_RECEIVED, data)
|
hass.bus.async_fire(EVENT_RECEIVED, data)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Configure based on config entry."""
|
"""Configure based on config entry."""
|
||||||
hass.components.webhook.async_register(
|
hass.components.webhook.async_register(
|
||||||
DOMAIN, "IFTTT", entry.data[CONF_WEBHOOK_ID], handle_webhook
|
DOMAIN, "IFTTT", entry.data[CONF_WEBHOOK_ID], handle_webhook
|
||||||
@ -119,7 +121,7 @@ async def async_setup_entry(hass, entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID])
|
hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID])
|
||||||
return True
|
return True
|
||||||
|
@ -13,12 +13,13 @@ from homeassistant.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_SOURCE,
|
CONF_SOURCE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import ServiceCall, callback
|
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.config_validation import make_entity_service_schema
|
from homeassistant.helpers.config_validation import make_entity_service_schema
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util.async_ import run_callback_threadsafe
|
from homeassistant.util.async_ import run_callback_threadsafe
|
||||||
|
|
||||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||||
@ -69,7 +70,7 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend(
|
|||||||
PLATFORM_SCHEMA_BASE = cv.PLATFORM_SCHEMA_BASE.extend(PLATFORM_SCHEMA.schema)
|
PLATFORM_SCHEMA_BASE = cv.PLATFORM_SCHEMA_BASE.extend(PLATFORM_SCHEMA.schema)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the image processing."""
|
"""Set up the image processing."""
|
||||||
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
||||||
|
|
||||||
|
@ -8,12 +8,13 @@ from incomfortclient import Gateway as InComfortGateway
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
||||||
from homeassistant.core import 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.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, hass_config):
|
async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
|
||||||
"""Create an Intergas InComfort/Intouch system."""
|
"""Create an Intergas InComfort/Intouch system."""
|
||||||
incomfort_data = hass.data[DOMAIN] = {}
|
incomfort_data = hass.data[DOMAIN] = {}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ from homeassistant.const import (
|
|||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import event as event_helper, state as state_helper
|
from homeassistant.helpers import event as event_helper, state as state_helper
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_values import EntityValues
|
from homeassistant.helpers.entity_values import EntityValues
|
||||||
@ -38,6 +38,7 @@ from homeassistant.helpers.entityfilter import (
|
|||||||
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA,
|
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA,
|
||||||
convert_include_exclude_filter,
|
convert_include_exclude_filter,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
API_VERSION_2,
|
API_VERSION_2,
|
||||||
@ -468,7 +469,7 @@ def get_influx_connection(conf, test_write=False, test_read=False): # noqa: C90
|
|||||||
return InfluxClient(databases, write_v1, query_v1, close_v1)
|
return InfluxClient(databases, write_v1, query_v1, close_v1)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the InfluxDB component."""
|
"""Set up the InfluxDB component."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
try:
|
try:
|
||||||
|
@ -5,9 +5,11 @@ import logging
|
|||||||
|
|
||||||
from pyinsteon import async_close, async_connect, devices
|
from pyinsteon import async_close, async_connect, devices
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from . import api
|
from . import api
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -70,7 +72,7 @@ async def close_insteon_connection(*args):
|
|||||||
await async_close()
|
await async_close()
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Insteon platform."""
|
"""Set up the Insteon platform."""
|
||||||
if DOMAIN not in config:
|
if DOMAIN not in config:
|
||||||
return True
|
return True
|
||||||
@ -89,7 +91,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up an Insteon entry."""
|
"""Set up an Insteon entry."""
|
||||||
|
|
||||||
if not devices.modem:
|
if not devices.modem:
|
||||||
|
@ -4,7 +4,9 @@ import copy
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_TYPE
|
from homeassistant.const import CONF_TYPE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv, intent, script, template
|
from homeassistant.helpers import config_validation as cv, intent, script, template
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
DOMAIN = "intent_script"
|
DOMAIN = "intent_script"
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Activate Alexa component."""
|
"""Activate Alexa component."""
|
||||||
intents = copy.deepcopy(config[DOMAIN])
|
intents = copy.deepcopy(config[DOMAIN])
|
||||||
template.attach(hass, intents)
|
template.attach(hass, intents)
|
||||||
|
@ -20,11 +20,12 @@ from homeassistant.const import (
|
|||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
DATA_RATE_MEGABITS_PER_SECOND,
|
DATA_RATE_MEGABITS_PER_SECOND,
|
||||||
)
|
)
|
||||||
from homeassistant.core import ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
DOMAIN = "iperf3"
|
DOMAIN = "iperf3"
|
||||||
DATA_UPDATED = f"{DOMAIN}_data_updated"
|
DATA_UPDATED = f"{DOMAIN}_data_updated"
|
||||||
@ -93,7 +94,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
SERVICE_SCHEMA = vol.Schema({vol.Optional(ATTR_HOST, default=None): cv.string})
|
SERVICE_SCHEMA = vol.Schema({vol.Optional(ATTR_HOST, default=None): cv.string})
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the iperf3 component."""
|
"""Set up the iperf3 component."""
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""Component for the Portuguese weather service - IPMA."""
|
"""Component for the Portuguese weather service - IPMA."""
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .config_flow import IpmaFlowHandler # noqa: F401
|
from .config_flow import IpmaFlowHandler # noqa: F401
|
||||||
from .const import DOMAIN # noqa: F401
|
from .const import DOMAIN # noqa: F401
|
||||||
@ -9,12 +11,12 @@ DEFAULT_NAME = "ipma"
|
|||||||
PLATFORMS = [Platform.WEATHER]
|
PLATFORMS = [Platform.WEATHER]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up IPMA station as config entry."""
|
"""Set up IPMA station as config entry."""
|
||||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -6,12 +6,14 @@ from prayer_times_calculator import PrayerTimesCalculator, exceptions
|
|||||||
from requests.exceptions import ConnectionError as ConnError
|
from requests.exceptions import ConnectionError as ConnError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.event import async_call_later, async_track_point_in_time
|
from homeassistant.helpers.event import async_call_later, async_track_point_in_time
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -41,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Import the Islamic Prayer component from config."""
|
"""Import the Islamic Prayer component from config."""
|
||||||
if DOMAIN in config:
|
if DOMAIN in config:
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
@ -53,7 +55,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry):
|
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
"""Set up the Islamic Prayer Component."""
|
"""Set up the Islamic Prayer Component."""
|
||||||
client = IslamicPrayerClient(hass, config_entry)
|
client = IslamicPrayerClient(hass, config_entry)
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, config_entry):
|
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
"""Unload Islamic Prayer entry from config_entry."""
|
"""Unload Islamic Prayer entry from config_entry."""
|
||||||
if hass.data[DOMAIN].event_unsub:
|
if hass.data[DOMAIN].event_unsub:
|
||||||
hass.data[DOMAIN].event_unsub()
|
hass.data[DOMAIN].event_unsub()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_EXCLUDE, Platform
|
from homeassistant.const import CONF_EXCLUDE, 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
|
||||||
@ -43,14 +44,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up from a config entry."""
|
"""Set up from a config entry."""
|
||||||
await async_start_discovery_service(hass)
|
await async_start_discovery_service(hass)
|
||||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload the config entry and stop discovery process."""
|
"""Unload the config entry and stop discovery process."""
|
||||||
await async_stop_discovery_service(hass)
|
await async_stop_discovery_service(hass)
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -13,8 +13,9 @@ from pyjoin import (
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_DEVICE_ID, CONF_NAME
|
from homeassistant.const import CONF_API_KEY, CONF_DEVICE_ID, CONF_NAME
|
||||||
from homeassistant.core import ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ def register_device(hass, api_key, name, device_id, device_ids, device_names):
|
|||||||
hass.services.register(DOMAIN, f"{name}send_tasker", send_tasker_service)
|
hass.services.register(DOMAIN, f"{name}send_tasker", send_tasker_service)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Join services."""
|
"""Set up the Join services."""
|
||||||
for device in config[DOMAIN]:
|
for device in config[DOMAIN]:
|
||||||
api_key = device.get(CONF_API_KEY)
|
api_key = device.get(CONF_API_KEY)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user