ConfigType and async_setup/setup type hint improvements (#54739)

pull/54814/head
Ville Skyttä 2021-08-18 14:22:05 +03:00 committed by GitHub
parent dcb2a211e5
commit 939fde0a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 114 additions and 71 deletions

View File

@ -5,12 +5,13 @@ from homeassistant.components import websocket_api
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.event import async_call_later, async_track_time_interval from homeassistant.helpers.event import async_call_later, async_track_time_interval
from homeassistant.helpers.typing import ConfigType
from .analytics import Analytics from .analytics import Analytics
from .const import ATTR_ONBOARDED, ATTR_PREFERENCES, DOMAIN, INTERVAL, PREFERENCE_SCHEMA from .const import ATTR_ONBOARDED, ATTR_PREFERENCES, DOMAIN, INTERVAL, PREFERENCE_SCHEMA
async def async_setup(hass: HomeAssistant, _): async def async_setup(hass: HomeAssistant, _: ConfigType) -> bool:
"""Set up the analytics integration.""" """Set up the analytics integration."""
analytics = Analytics(hass) analytics = Analytics(hass)

View File

@ -36,7 +36,7 @@ async def _await_cancel(task):
await task await task
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the component.""" """Set up the component."""
hass.data[DOMAIN_DATA_ENTRIES] = {} hass.data[DOMAIN_DATA_ENTRIES] = {}
hass.data[DOMAIN_DATA_TASKS] = {} hass.data[DOMAIN_DATA_TASKS] = {}

View File

@ -23,6 +23,7 @@ from homeassistant.helpers import device_registry, discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import track_utc_time_change from homeassistant.helpers.event import track_utc_time_change
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import slugify from homeassistant.util import slugify
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -79,7 +80,7 @@ _SERVICE_MAP = {
UNDO_UPDATE_LISTENER = "undo_update_listener" UNDO_UPDATE_LISTENER = "undo_update_listener"
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the BMW Connected Drive component from configuration.yaml.""" """Set up the BMW Connected Drive component from configuration.yaml."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][DATA_HASS_CONFIG] = config hass.data[DOMAIN][DATA_HASS_CONFIG] = config

View File

@ -8,13 +8,14 @@ import coronavirus
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import aiohttp_client, entity_registry, update_coordinator from homeassistant.helpers import aiohttp_client, entity_registry, update_coordinator
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN from .const import DOMAIN
PLATFORMS = ["sensor"] PLATFORMS = ["sensor"]
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Coronavirus component.""" """Set up the Coronavirus component."""
# Make sure coordinator is initialized. # Make sure coordinator is initialized.
await get_coordinator(hass) await get_coordinator(hass)

View File

@ -41,6 +41,7 @@ from homeassistant.helpers.event import (
async_track_state_added_domain, async_track_state_added_domain,
async_track_time_interval, async_track_time_interval,
) )
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import async_get_dhcp from homeassistant.loader import async_get_dhcp
from homeassistant.util.network import is_invalid, is_link_local, is_loopback from homeassistant.util.network import is_invalid, is_link_local, is_loopback
@ -58,7 +59,7 @@ SCAN_INTERVAL = timedelta(minutes=60)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the dhcp component.""" """Set up the dhcp component."""
async def _initialize(_): async def _initialize(_):

View File

@ -22,6 +22,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.network import get_url from homeassistant.helpers.network import get_url
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import dt as dt_util, slugify from homeassistant.util import dt as dt_util, slugify
from .const import ( from .const import (
@ -58,7 +59,7 @@ DEVICE_SCHEMA = vol.Schema(
CONFIG_SCHEMA = cv.deprecated(DOMAIN) CONFIG_SCHEMA = cv.deprecated(DOMAIN)
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the DoorBird component.""" """Set up the DoorBird component."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -12,6 +12,7 @@ from homeassistant.const import CONF_DEFAULT, CONF_HOST, CONF_NAME, CONF_PORT, C
from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.core import HomeAssistant, ServiceCall
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.typing import ConfigType
# Loading the config flow file will register the flow # Loading the config flow file will register the flow
from .bridge import DynaliteBridge from .bridge import DynaliteBridge
@ -179,7 +180,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Dynalite platform.""" """Set up the Dynalite platform."""
conf = config.get(DOMAIN) conf = config.get(DOMAIN)
LOGGER.debug("Setting up dynalite component config = %s", conf) LOGGER.debug("Setting up dynalite component config = %s", conf)

View File

@ -18,6 +18,7 @@ from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_registry import RegistryEntry from homeassistant.helpers.entity_registry import RegistryEntry
from homeassistant.helpers.template import Template, is_template_string from homeassistant.helpers.template import Template, is_template_string
from homeassistant.helpers.typing import ConfigType
from .const import CONF_POWER, CONF_POWER_ENTITY, DOMAIN from .const import CONF_POWER, CONF_POWER_ENTITY, DOMAIN
@ -48,7 +49,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the emulated_kasa component.""" """Set up the emulated_kasa component."""
conf = config.get(DOMAIN) conf = config.get(DOMAIN)
if not conf: if not conf:

View File

@ -25,6 +25,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401
) )
from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from homeassistant.util.percentage import ( from homeassistant.util.percentage import (
ordered_list_item_to_percentage, ordered_list_item_to_percentage,
@ -124,7 +125,7 @@ def is_on(hass, entity_id: str) -> bool:
return state.state == STATE_ON return state.state == STATE_ON
async def async_setup(hass, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Expose fan control via statemachine and services.""" """Expose fan control via statemachine and services."""
component = hass.data[DOMAIN] = EntityComponent( component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL _LOGGER, DOMAIN, hass, SCAN_INTERVAL

View File

@ -19,6 +19,7 @@ from homeassistant.const import (
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, device_registry as dr from homeassistant.helpers import config_validation as cv, device_registry as dr
from homeassistant.helpers.typing import ConfigType
from .board import FirmataBoard from .board import FirmataBoard
from .const import ( from .const import (
@ -122,7 +123,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Firmata domain.""" """Set up the Firmata domain."""
# Delete specific entries that no longer exist in the config # Delete specific entries that no longer exist in the config
if hass.config_entries.async_entries(DOMAIN): if hass.config_entries.async_entries(DOMAIN):

View File

@ -2,14 +2,13 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
import voluptuous as vol import voluptuous as vol
# Typing imports
from homeassistant.const import CONF_API_KEY, CONF_NAME from homeassistant.const import CONF_API_KEY, CONF_NAME
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
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
CONF_ALIASES, CONF_ALIASES,
@ -91,7 +90,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, yaml_config: dict[str, Any]): async def async_setup(hass: HomeAssistant, yaml_config: ConfigType) -> bool:
"""Activate Google Actions component.""" """Activate Google Actions component."""
if DOMAIN not in yaml_config: if DOMAIN not in yaml_config:
return True return True

View File

@ -5,7 +5,6 @@ import datetime
import json import json
import logging import logging
import os import os
from typing import Any
from google.cloud import pubsub_v1 from google.cloud import pubsub_v1
import voluptuous as vol import voluptuous as vol
@ -14,6 +13,7 @@ from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNAVAILABLE, STATE_UN
from homeassistant.core import Event, HomeAssistant from homeassistant.core import Event, HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entityfilter import FILTER_SCHEMA from homeassistant.helpers.entityfilter import FILTER_SCHEMA
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -39,7 +39,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
def setup(hass: HomeAssistant, yaml_config: dict[str, Any]): def setup(hass: HomeAssistant, yaml_config: ConfigType) -> bool:
"""Activate Google Pub/Sub component.""" """Activate Google Pub/Sub component."""
config = yaml_config[DOMAIN] config = yaml_config[DOMAIN]
project_id = config[CONF_PROJECT_ID] project_id = config[CONF_PROJECT_ID]

View File

@ -16,6 +16,7 @@ from homeassistant.const import (
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.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
ATTR_ARGS, ATTR_ARGS,
@ -83,7 +84,7 @@ SERVICE_API_CALL_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Habitica service.""" """Set up the Habitica service."""
configs = config.get(DOMAIN, []) configs = config.get(DOMAIN, [])

View File

@ -45,6 +45,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery, event from homeassistant.helpers import discovery, event
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType
DOMAIN = "hdmi_cec" DOMAIN = "hdmi_cec"
@ -186,7 +187,7 @@ def parse_mapping(mapping, parents=None):
yield (val, pad_physical_address(cur)) yield (val, pad_physical_address(cur))
def setup(hass: HomeAssistant, base_config): # noqa: C901 def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901
"""Set up the CEC capability.""" """Set up the CEC capability."""
# Parse configuration into a dict of device name to physical address # Parse configuration into a dict of device name to physical address

View File

@ -43,7 +43,7 @@ MIN_UPDATE_SOURCES = timedelta(seconds=1)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the HEOS component.""" """Set up the HEOS component."""
if DOMAIN not in config: if DOMAIN not in config:
return True return True

View File

@ -10,6 +10,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import Throttle from homeassistant.util import Throttle
from . import api, config_flow from . import api, config_flow
@ -34,7 +35,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["binary_sensor", "light", "sensor", "switch"] PLATFORMS = ["binary_sensor", "light", "sensor", "switch"]
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up Home Connect component.""" """Set up Home Connect component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -16,6 +16,7 @@ from homeassistant.helpers import (
dispatcher, dispatcher,
) )
from homeassistant.helpers.device_registry import async_get as async_get_device_registry from homeassistant.helpers.device_registry import async_get as async_get_device_registry
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from . import config_flow, helpers from . import config_flow, helpers
@ -50,7 +51,7 @@ PLATFORMS = ["switch"]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Legrand Home+ Control component from configuration.yaml.""" """Set up the Legrand Home+ Control component from configuration.yaml."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -26,6 +26,7 @@ from homeassistant.helpers.service import (
async_extract_config_entry_ids, async_extract_config_entry_ids,
async_extract_referenced_entity_ids, async_extract_referenced_entity_ids,
) )
from homeassistant.helpers.typing import ConfigType
ATTR_ENTRY_ID = "entry_id" ATTR_ENTRY_ID = "entry_id"
@ -51,7 +52,7 @@ SCHEMA_RELOAD_CONFIG_ENTRY = vol.All(
SHUTDOWN_SERVICES = (SERVICE_HOMEASSISTANT_STOP, SERVICE_HOMEASSISTANT_RESTART) SHUTDOWN_SERVICES = (SERVICE_HOMEASSISTANT_STOP, SERVICE_HOMEASSISTANT_RESTART)
async def async_setup(hass: ha.HomeAssistant, config: dict) -> bool: # noqa: C901 async def async_setup(hass: ha.HomeAssistant, config: ConfigType) -> bool: # noqa: C901
"""Set up general services related to Home Assistant.""" """Set up general services related to Home Assistant."""
async def async_save_persistent_states(service): async def async_save_persistent_states(service):

View File

@ -44,6 +44,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entityfilter import BASE_FILTER_SCHEMA, FILTER_SCHEMA from homeassistant.helpers.entityfilter import BASE_FILTER_SCHEMA, FILTER_SCHEMA
from homeassistant.helpers.reload import async_integration_yaml_config from homeassistant.helpers.reload import async_integration_yaml_config
from homeassistant.helpers.service import async_extract_referenced_entity_ids from homeassistant.helpers.service import async_extract_referenced_entity_ids
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import IntegrationNotFound, async_get_integration from homeassistant.loader import IntegrationNotFound, async_get_integration
from . import ( # noqa: F401 from . import ( # noqa: F401
@ -187,7 +188,7 @@ def _async_get_entries_by_name(current_entries):
return {entry.data.get(CONF_NAME, BRIDGE_NAME): entry for entry in current_entries} return {entry.data.get(CONF_NAME, BRIDGE_NAME): entry for entry in current_entries}
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the HomeKit from yaml.""" """Set up the HomeKit from yaml."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -298,7 +298,7 @@ class Router:
class HuaweiLteData: class HuaweiLteData:
"""Shared state.""" """Shared state."""
hass_config: dict = attr.ib() hass_config: ConfigType = attr.ib()
# Our YAML config, keyed by router URL # Our YAML config, keyed by router URL
config: dict[str, dict[str, Any]] = attr.ib() config: dict[str, dict[str, Any]] = attr.ib()
routers: dict[str, Router] = attr.ib(init=False, factory=dict) routers: dict[str, Router] = attr.ib(init=False, factory=dict)

View File

@ -18,6 +18,7 @@ from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import collection from homeassistant.helpers import collection
from homeassistant.helpers.storage import Store from homeassistant.helpers.storage import Store
from homeassistant.helpers.typing import ConfigType
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from .const import DOMAIN from .const import DOMAIN
@ -37,7 +38,7 @@ UPDATE_FIELDS = {
} }
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Image integration.""" """Set up the Image integration."""
image_dir = pathlib.Path(hass.config.path(DOMAIN)) image_dir = pathlib.Path(hass.config.path(DOMAIN))
hass.data[DOMAIN] = storage_collection = ImageStorageCollection(hass, image_dir) hass.data[DOMAIN] = storage_collection = ImageStorageCollection(hass, image_dir)

View File

@ -6,11 +6,12 @@ from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.const import SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON from homeassistant.const import SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.core import DOMAIN as HA_DOMAIN, HomeAssistant from homeassistant.core import DOMAIN as HA_DOMAIN, HomeAssistant
from homeassistant.helpers import config_validation as cv, integration_platform, intent from homeassistant.helpers import config_validation as cv, integration_platform, intent
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN from .const import DOMAIN
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Intent component.""" """Set up the Intent component."""
hass.http.register_view(IntentHandleView()) hass.http.register_view(IntentHandleView())

View File

@ -26,7 +26,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Register the iZone component config.""" """Register the iZone component config."""
conf = config.get(IZONE) conf = config.get(IZONE)
if not conf: if not conf:

View File

@ -12,6 +12,7 @@ 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.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import DOMAIN, JUICENET_API, JUICENET_COORDINATOR from .const import DOMAIN, JUICENET_API, JUICENET_COORDINATOR
@ -30,7 +31,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the JuiceNet component.""" """Set up the JuiceNet component."""
conf = config.get(DOMAIN) conf = config.get(DOMAIN)
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -36,6 +36,7 @@ from homeassistant.const import (
) )
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.typing import ConfigType
from .config_flow import ( # Loading the config flow file will register the flow from .config_flow import ( # Loading the config flow file will register the flow
CONF_DEFAULT_OPTIONS, CONF_DEFAULT_OPTIONS,
@ -220,7 +221,7 @@ YAML_CONFIGS = "yaml_configs"
PLATFORMS = ["binary_sensor", "sensor", "switch"] PLATFORMS = ["binary_sensor", "sensor", "switch"]
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Konnected platform.""" """Set up the Konnected platform."""
cfg = config.get(DOMAIN) cfg = config.get(DOMAIN)
if cfg is None: if cfg is None:

View File

@ -67,7 +67,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Lovelace commands.""" """Set up the Lovelace commands."""
mode = config[DOMAIN][CONF_MODE] mode = config[DOMAIN][CONF_MODE]
yaml_resources = config[DOMAIN].get(CONF_RESOURCES) yaml_resources = config[DOMAIN].get(CONF_RESOURCES)

View File

@ -23,6 +23,7 @@ from homeassistant.helpers import (
device_registry as dr, device_registry as dr,
) )
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
@ -50,7 +51,7 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["climate", "sensor"] PLATFORMS = ["climate", "sensor"]
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Honeywell Lyric component.""" """Set up the Honeywell Lyric component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -14,6 +14,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.integration_platform import ( from homeassistant.helpers.integration_platform import (
async_process_integration_platforms, async_process_integration_platforms,
) )
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from . import local_source, models from . import local_source, models
@ -36,7 +37,7 @@ def generate_media_source_id(domain: str, identifier: str) -> str:
return uri return uri
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the media_source component.""" """Set up the media_source component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}
hass.components.websocket_api.async_register_command(websocket_browse_media) hass.components.websocket_api.async_register_command(websocket_browse_media)

View File

@ -17,6 +17,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import Throttle from homeassistant.util import Throttle
from .const import DOMAIN from .const import DOMAIN
@ -44,7 +45,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: ConfigEntry): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Establish connection with MELCloud.""" """Establish connection with MELCloud."""
if DOMAIN not in config: if DOMAIN not in config:
return True return True

View File

@ -36,7 +36,7 @@ from .webhook import handle_webhook
PLATFORMS = "sensor", "binary_sensor", "device_tracker" PLATFORMS = "sensor", "binary_sensor", "device_tracker"
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the mobile app component.""" """Set up the mobile app component."""
store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY) store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
app_config = await store.async_load() app_config = await store.async_load()

View File

@ -27,6 +27,7 @@ from homeassistant.helpers import (
config_entry_oauth2_flow, config_entry_oauth2_flow,
config_validation as cv, config_validation as cv,
) )
from homeassistant.helpers.typing import ConfigType
from . import api, config_flow from . import api, config_flow
from .const import DATA_SDM, DATA_SUBSCRIBER, DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN from .const import DATA_SDM, DATA_SUBSCRIBER, DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN
@ -69,7 +70,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["sensor", "camera", "climate"] PLATFORMS = ["sensor", "camera", "climate"]
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up Nest components with dispatch between old/new flows.""" """Set up Nest components with dispatch between old/new flows."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -31,6 +31,7 @@ from homeassistant.helpers.dispatcher import (
async_dispatcher_send, async_dispatcher_send,
) )
from homeassistant.helpers.event import async_call_later from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.typing import ConfigType
from . import api, config_flow from . import api, config_flow
from .const import ( from .const import (
@ -69,7 +70,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Netatmo component.""" """Set up the Netatmo component."""
hass.data[DOMAIN] = { hass.data[DOMAIN] = {
DATA_PERSONS: {}, DATA_PERSONS: {},

View File

@ -7,13 +7,14 @@ from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PLATFORM
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN from .const import DOMAIN
PLATFORMS = [NOTIFY] PLATFORMS = [NOTIFY]
async def async_setup(hass: HomeAssistant, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the NFAndroidTV component.""" """Set up the NFAndroidTV component."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
# Iterate all entries for notify to only get nfandroidtv # Iterate all entries for notify to only get nfandroidtv

View File

@ -13,6 +13,7 @@ from homeassistant.const import (
) )
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.typing import ConfigType
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import ( from .const import (
@ -60,7 +61,7 @@ SPEED_LIMIT_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the NZBGet integration.""" """Set up the NZBGet integration."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -16,6 +16,7 @@ from homeassistant.const import (
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import config_per_platform from homeassistant.helpers import config_per_platform
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
CONF_RTSP_TRANSPORT, CONF_RTSP_TRANSPORT,
@ -31,7 +32,7 @@ from .const import (
from .device import ONVIFDevice from .device import ONVIFDevice
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the ONVIF component.""" """Set up the ONVIF component."""
# Import from yaml # Import from yaml
configs = {} configs = {}

View File

@ -15,6 +15,7 @@ from homeassistant.exceptions import TemplateError
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity import async_generate_entity_id from homeassistant.helpers.entity import async_generate_entity_id
from homeassistant.helpers.template import Template from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from homeassistant.util import slugify from homeassistant.util import slugify
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -100,7 +101,7 @@ def async_dismiss(hass: HomeAssistant, notification_id: str) -> None:
hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_DISMISS, data)) hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_DISMISS, data))
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the persistent notification component.""" """Set up the persistent notification component."""
persistent_notifications: MutableMapping[str, MutableMapping] = OrderedDict() persistent_notifications: MutableMapping[str, MutableMapping] = OrderedDict()
hass.data[DOMAIN] = {"notifications": persistent_notifications} hass.data[DOMAIN] = {"notifications": persistent_notifications}

View File

@ -293,7 +293,7 @@ The following persons point at invalid users:
return filtered return filtered
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the person component.""" """Set up the person component."""
entity_component = EntityComponent(_LOGGER, DOMAIN, hass) entity_component = EntityComponent(_LOGGER, DOMAIN, hass)
id_manager = collection.IDManager() id_manager = collection.IDManager()

View File

@ -10,6 +10,7 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTAN
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
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
from .utils import load_plum from .utils import load_plum
@ -34,7 +35,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["light"] PLATFORMS = ["light"]
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Plum Lightpad Platform initialization.""" """Plum Lightpad Platform initialization."""
if DOMAIN not in config: if DOMAIN not in config:
return True return True

View File

@ -20,6 +20,7 @@ from homeassistant.const import (
) )
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.typing import ConfigType
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
@ -86,7 +87,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the platform.""" """Set up the platform."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -13,6 +13,7 @@ from homeassistant.helpers.entity_registry import (
async_get, async_get,
async_migrate_entries, async_migrate_entries,
) )
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
ATTR_POWER, ATTR_POWER,
@ -41,7 +42,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the electricity price sensor from configuration.yaml.""" """Set up the electricity price sensor from configuration.yaml."""
for conf in config.get(DOMAIN, []): for conf in config.get(DOMAIN, []):
hass.async_create_task( hass.async_create_task(

View File

@ -31,6 +31,7 @@ from homeassistant.helpers.entity_component import (
EntityComponent, EntityComponent,
) )
from homeassistant.helpers.reload import async_reload_integration_platforms from homeassistant.helpers.reload import async_reload_integration_platforms
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import COORDINATOR, DOMAIN, PLATFORM_IDX, REST, REST_DATA, REST_IDX from .const import COORDINATOR, DOMAIN, PLATFORM_IDX, REST, REST_DATA, REST_IDX
@ -43,7 +44,7 @@ PLATFORMS = ["binary_sensor", "notify", "sensor", "switch"]
COORDINATOR_AWARE_PLATFORMS = [SENSOR_DOMAIN, BINARY_SENSOR_DOMAIN] COORDINATOR_AWARE_PLATFORMS = [SENSOR_DOMAIN, BINARY_SENSOR_DOMAIN]
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the rest platforms.""" """Set up the rest platforms."""
component = EntityComponent(_LOGGER, DOMAIN, hass) component = EntityComponent(_LOGGER, DOMAIN, hass)
_async_setup_shared_data(hass) _async_setup_shared_data(hass)

View File

@ -1,11 +1,12 @@
"""The Safe Mode integration.""" """The Safe Mode integration."""
from homeassistant.components import persistent_notification from homeassistant.components import persistent_notification
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
DOMAIN = "safe_mode" DOMAIN = "safe_mode"
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Safe Mode component.""" """Set up the Safe Mode component."""
persistent_notification.async_create( persistent_notification.async_create(
hass, hass,

View File

@ -16,6 +16,7 @@ from homeassistant.const import CONF_IP_ADDRESS, CONF_PORT, CONF_SCAN_INTERVAL
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
@ -31,7 +32,7 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS = ["switch", "sensor", "binary_sensor", "climate"] PLATFORMS = ["switch", "sensor", "binary_sensor", "climate"]
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Screenlogic component.""" """Set up the Screenlogic component."""
domain_data = hass.data[DOMAIN] = {} domain_data = hass.data[DOMAIN] = {}
domain_data[DISCOVERED_GATEWAYS] = await async_discover_gateways_by_unique_id(hass) domain_data[DISCOVERED_GATEWAYS] = await async_discover_gateways_by_unique_id(hass)

View File

@ -11,12 +11,13 @@ from homeassistant.components.homeassistant import scene
from homeassistant.core import HomeAssistant, callback, split_entity_id from homeassistant.core import HomeAssistant, callback, split_entity_id
from homeassistant.helpers import device_registry, entity_registry from homeassistant.helpers import device_registry, entity_registry
from homeassistant.helpers.entity import entity_sources as get_entity_sources from homeassistant.helpers.entity import entity_sources as get_entity_sources
from homeassistant.helpers.typing import ConfigType
DOMAIN = "search" DOMAIN = "search"
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Search component.""" """Set up the Search component."""
websocket_api.async_register_command(hass, websocket_search_related) websocket_api.async_register_command(hass, websocket_search_related)
return True return True

View File

@ -12,6 +12,7 @@ from homeassistant.const import (
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import Throttle from homeassistant.util import Throttle
from . import api, config_flow from . import api, config_flow
@ -37,7 +38,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Smappee component.""" """Set up the Smappee component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -9,6 +9,7 @@ from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
DOMAIN = "smarthab" DOMAIN = "smarthab"
DATA_HUB = "hub" DATA_HUB = "hub"
@ -32,7 +33,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass, config) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the SmartHab platform.""" """Set up the SmartHab platform."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -57,7 +57,7 @@ from .smartapp import (
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Initialize the SmartThings platform.""" """Initialize the SmartThings platform."""
await setup_smartapp_endpoint(hass) await setup_smartapp_endpoint(hass)
return True return True

View File

@ -1,5 +1,4 @@
"""The songpal component.""" """The songpal component."""
from collections import OrderedDict
import voluptuous as vol import voluptuous as vol
@ -7,6 +6,7 @@ from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_NAME from homeassistant.const import CONF_NAME
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.typing import ConfigType
from .const import CONF_ENDPOINT, DOMAIN from .const import CONF_ENDPOINT, DOMAIN
@ -22,7 +22,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["media_player"] PLATFORMS = ["media_player"]
async def async_setup(hass: HomeAssistant, config: OrderedDict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up songpal environment.""" """Set up songpal environment."""
conf = config.get(DOMAIN) conf = config.get(DOMAIN)
if conf is None: if conf is None:

View File

@ -17,6 +17,7 @@ import attr
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_per_platform, discovery from homeassistant.helpers import config_per_platform, discovery
from homeassistant.helpers.typing import ConfigType
from homeassistant.setup import async_prepare_setup_platform from homeassistant.setup import async_prepare_setup_platform
from .const import ( from .const import (
@ -34,7 +35,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistant, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up STT.""" """Set up STT."""
providers = {} providers = {}

View File

@ -16,6 +16,7 @@ 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.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_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
from .const import ( from .const import (
ATTR_FLAP_ID, ATTR_FLAP_ID,
@ -62,7 +63,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Sure Petcare integration.""" """Set up the Sure Petcare integration."""
conf = config[DOMAIN] conf = config[DOMAIN]
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -16,6 +16,7 @@ from homeassistant.helpers import (
update_coordinator, update_coordinator,
) )
from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
CONF_DEVICE_PASSWORD, CONF_DEVICE_PASSWORD,
@ -49,7 +50,7 @@ CCONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the switcher component.""" """Set up the switcher component."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -43,7 +43,7 @@ def async_register_info(
SystemHealthRegistration(hass, domain).async_register_info(info_callback) SystemHealthRegistration(hass, domain).async_register_info(info_callback)
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the System Health component.""" """Set up the System Health component."""
hass.components.websocket_api.async_register_command(handle_info) hass.components.websocket_api.async_register_command(handle_info)
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})

View File

@ -56,7 +56,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Tradfri component.""" """Set up the Tradfri component."""
conf = config.get(DOMAIN) conf = config.get(DOMAIN)

View File

@ -55,7 +55,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: ConfigType): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up UPnP component.""" """Set up UPnP component."""
LOGGER.debug("async_setup, config: %s", config) LOGGER.debug("async_setup, config: %s", config)
conf_default = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN] conf_default = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN]

View File

@ -25,6 +25,7 @@ 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.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import convert, slugify from homeassistant.util import convert, slugify
from homeassistant.util.dt import utc_from_timestamp from homeassistant.util.dt import utc_from_timestamp
@ -63,7 +64,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, base_config: dict) -> bool: async def async_setup(hass: HomeAssistant, base_config: ConfigType) -> bool:
"""Set up for Vera controllers.""" """Set up for Vera controllers."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -28,6 +28,7 @@ from homeassistant.helpers import (
config_entry_oauth2_flow, config_entry_oauth2_flow,
config_validation as cv, config_validation as cv,
) )
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from . import api, config_flow from . import api, config_flow
@ -50,7 +51,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["media_player", "remote", "binary_sensor", "sensor"] PLATFORMS = ["media_player", "remote", "binary_sensor", "sensor"]
async def async_setup(hass: HomeAssistant, config: dict): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the xbox component.""" """Set up the xbox component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -24,6 +24,7 @@ from homeassistant.helpers.dispatcher import (
async_dispatcher_send, async_dispatcher_send,
) )
from homeassistant.helpers.entity import DeviceInfo, Entity from homeassistant.helpers.entity import DeviceInfo, Entity
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -152,7 +153,7 @@ UPDATE_REQUEST_PROPERTIES = [
PLATFORMS = ["binary_sensor", "light"] PLATFORMS = ["binary_sensor", "light"]
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Yeelight bulbs.""" """Set up the Yeelight bulbs."""
conf = config.get(DOMAIN, {}) conf = config.get(DOMAIN, {})
hass.data[DOMAIN] = { hass.data[DOMAIN] = {

View File

@ -28,6 +28,7 @@ from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.network import NoURLAvailableError, get_url from homeassistant.helpers.network import NoURLAvailableError, get_url
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import async_get_homekit, async_get_zeroconf, bind_hass from homeassistant.loader import async_get_homekit, async_get_zeroconf, bind_hass
from .models import HaAsyncServiceBrowser, HaAsyncZeroconf, HaZeroconf from .models import HaAsyncServiceBrowser, HaAsyncZeroconf, HaZeroconf
@ -137,7 +138,7 @@ def _async_use_default_interface(adapters: list[Adapter]) -> bool:
return True return True
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up Zeroconf and make Home Assistant discoverable.""" """Set up Zeroconf and make Home Assistant discoverable."""
zc_args: dict = {} zc_args: dict = {}

View File

@ -30,6 +30,7 @@ from homeassistant.helpers import (
service, service,
storage, storage,
) )
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from homeassistant.util.location import distance from homeassistant.util.location import distance
@ -176,7 +177,7 @@ class ZoneStorageCollection(collection.StorageCollection):
return {**data, **update_data} return {**data, **update_data}
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up configured zones as well as Home Assistant zone if necessary.""" """Set up configured zones as well as Home Assistant zone if necessary."""
component = entity_component.EntityComponent(_LOGGER, DOMAIN, hass) component = entity_component.EntityComponent(_LOGGER, DOMAIN, hass)
id_manager = collection.IDManager() id_manager = collection.IDManager()

View File

@ -28,6 +28,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry, entity_registry from homeassistant.helpers import device_registry, entity_registry
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import ConfigType
from .addon import AddonError, AddonManager, AddonState, get_addon_manager from .addon import AddonError, AddonManager, AddonState, get_addon_manager
from .api import async_register_api from .api import async_register_api
@ -79,7 +80,7 @@ DATA_CONNECT_FAILED_LOGGED = "connect_failed_logged"
DATA_INVALID_SERVER_VERSION_LOGGED = "invalid_server_version_logged" DATA_INVALID_SERVER_VERSION_LOGGED = "invalid_server_version_logged"
async def async_setup(hass: HomeAssistant, config: dict) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Z-Wave JS component.""" """Set up the Z-Wave JS component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}
return True return True

View File

@ -925,7 +925,7 @@ async def async_process_component_config( # noqa: C901
@callback @callback
def config_without_domain(config: dict, domain: str) -> dict: def config_without_domain(config: ConfigType, domain: str) -> ConfigType:
"""Return a config with all configuration for a domain removed.""" """Return a config with all configuration for a domain removed."""
filter_keys = extract_domain_configs(config, domain) filter_keys = extract_domain_configs(config, domain)
return {key: value for key, value in config.items() if key not in filter_keys} return {key: value for key, value in config.items() if key not in filter_keys}

View File

@ -1,8 +1,6 @@
"""The NEW_NAME integration.""" """The NEW_NAME integration."""
from __future__ import annotations from __future__ import annotations
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
@ -13,6 +11,7 @@ from homeassistant.helpers import (
config_entry_oauth2_flow, config_entry_oauth2_flow,
config_validation as cv, config_validation as cv,
) )
from homeassistant.helpers.typing import ConfigType
from . import api, config_flow from . import api, config_flow
from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN
@ -34,7 +33,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["light"] PLATFORMS = ["light"]
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the NEW_NAME component.""" """Set up the NEW_NAME component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}

View File

@ -1,17 +1,16 @@
"""The NEW_NAME integration.""" """The NEW_NAME integration."""
from __future__ import annotations from __future__ import annotations
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN from .const import DOMAIN
CONFIG_SCHEMA = vol.Schema({vol.Optional(DOMAIN): {}}, extra=vol.ALLOW_EXTRA) CONFIG_SCHEMA = vol.Schema({vol.Optional(DOMAIN): {}}, extra=vol.ALLOW_EXTRA)
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the NEW_NAME integration.""" """Set up the NEW_NAME integration."""
return True return True