diff --git a/homeassistant/components/bbb_gpio/__init__.py b/homeassistant/components/bbb_gpio/__init__.py index 9cc94de0910..511292cfb6f 100644 --- a/homeassistant/components/bbb_gpio/__init__.py +++ b/homeassistant/components/bbb_gpio/__init__.py @@ -4,13 +4,15 @@ import logging from Adafruit_BBIO import GPIO # pylint: disable=import-error from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType DOMAIN = "bbb_gpio" _LOGGER = logging.getLogger(__name__) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the BeagleBone Black GPIO component.""" _LOGGER.warning( "The BeagleBone Black GPIO integration is deprecated and will be removed " diff --git a/homeassistant/components/blink/__init__.py b/homeassistant/components/blink/__init__.py index 5845c61c330..7321e2392df 100644 --- a/homeassistant/components/blink/__init__.py +++ b/homeassistant/components/blink/__init__.py @@ -7,9 +7,9 @@ from blinkpy.blinkpy import Blink import voluptuous as vol from homeassistant.components import persistent_notification -from homeassistant.config_entries import SOURCE_REAUTH +from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry from homeassistant.const import CONF_FILENAME, CONF_NAME, CONF_PIN, CONF_SCAN_INTERVAL -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import config_validation as cv @@ -60,7 +60,7 @@ def _reauth_flow_wrapper(hass, data): ) -async def async_migrate_entry(hass, entry): +async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Handle migration of a previous version config entry.""" _LOGGER.debug("Migrating from version %s", entry.version) data = {**entry.data} @@ -74,7 +74,7 @@ async def async_migrate_entry(hass, entry): return True -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Blink via config entry.""" hass.data.setdefault(DOMAIN, {}) @@ -125,7 +125,7 @@ def _async_import_options_from_data_if_missing(hass, entry): hass.config_entries.async_update_entry(entry, options=options) -async def async_unload_entry(hass, entry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload Blink entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/bloomsky/__init__.py b/homeassistant/components/bloomsky/__init__.py index 3c049fe2176..8311f6cbd96 100644 --- a/homeassistant/components/bloomsky/__init__.py +++ b/homeassistant/components/bloomsky/__init__.py @@ -8,8 +8,10 @@ import requests import voluptuous as vol from homeassistant.const import CONF_API_KEY, Platform +from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -27,7 +29,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the BloomSky integration.""" api_key = config[DOMAIN][CONF_API_KEY] diff --git a/homeassistant/components/blueprint/__init__.py b/homeassistant/components/blueprint/__init__.py index 309365710ad..23ab6398333 100644 --- a/homeassistant/components/blueprint/__init__.py +++ b/homeassistant/components/blueprint/__init__.py @@ -1,4 +1,7 @@ """The blueprint integration.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + from . import websocket_api from .const import DOMAIN # noqa: F401 from .errors import ( # noqa: F401 @@ -13,7 +16,7 @@ from .models import Blueprint, BlueprintInputs, DomainBlueprints # noqa: F401 from .schemas import is_blueprint_instance_config # noqa: F401 -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the blueprint integration.""" websocket_api.async_setup(hass) return True diff --git a/homeassistant/components/bme280/__init__.py b/homeassistant/components/bme280/__init__.py index 591cecdaffe..59ad42da944 100644 --- a/homeassistant/components/bme280/__init__.py +++ b/homeassistant/components/bme280/__init__.py @@ -5,7 +5,9 @@ import voluptuous as vol from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_SCAN_INTERVAL +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, discovery +from homeassistant.helpers.typing import ConfigType from .const import ( CONF_DELTA_TEMP, @@ -89,7 +91,7 @@ CONFIG_SCHEMA = vol.Schema( _LOGGER = logging.getLogger(__name__) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up BME280 component.""" _LOGGER.warning( "The Bosch BME280 Environmental Sensor integration is deprecated and " diff --git a/homeassistant/components/calendar/__init__.py b/homeassistant/components/calendar/__init__.py index 1666a30a1f5..c09f51d71e7 100644 --- a/homeassistant/components/calendar/__init__.py +++ b/homeassistant/components/calendar/__init__.py @@ -21,6 +21,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401 from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.template import DATE_STR_FORMAT +from homeassistant.helpers.typing import ConfigType from homeassistant.util import dt # mypy: allow-untyped-defs, no-check-untyped-defs @@ -32,7 +33,7 @@ ENTITY_ID_FORMAT = DOMAIN + ".{}" SCAN_INTERVAL = timedelta(seconds=60) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Track states and offer events for calendars.""" component = hass.data[DOMAIN] = EntityComponent( _LOGGER, DOMAIN, hass, SCAN_INTERVAL diff --git a/homeassistant/components/cert_expiry/__init__.py b/homeassistant/components/cert_expiry/__init__.py index 2980d4ca5d4..95f1b660520 100644 --- a/homeassistant/components/cert_expiry/__init__.py +++ b/homeassistant/components/cert_expiry/__init__.py @@ -55,7 +55,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return True -async def async_unload_entry(hass, entry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/circuit/__init__.py b/homeassistant/components/circuit/__init__.py index 37fb5cbf6f3..877859f8c25 100644 --- a/homeassistant/components/circuit/__init__.py +++ b/homeassistant/components/circuit/__init__.py @@ -2,7 +2,9 @@ import voluptuous as vol from homeassistant.const import CONF_NAME, CONF_URL +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, discovery +from homeassistant.helpers.typing import ConfigType DOMAIN = "circuit" CONF_WEBHOOK = "webhook" @@ -21,7 +23,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Unify Circuit component.""" webhooks = config[DOMAIN][CONF_WEBHOOK] diff --git a/homeassistant/components/cloud/__init__.py b/homeassistant/components/cloud/__init__.py index 55c0a86c75c..6fc1cb7b7a7 100644 --- a/homeassistant/components/cloud/__init__.py +++ b/homeassistant/components/cloud/__init__.py @@ -13,9 +13,10 @@ from homeassistant.const import ( CONF_REGION, EVENT_HOMEASSISTANT_STOP, ) -from homeassistant.core import ServiceCall, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_validation as cv, entityfilter +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass from homeassistant.util.aiohttp import MockRequest @@ -168,7 +169,7 @@ def is_cloudhook_request(request): return isinstance(request, MockRequest) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize the Home Assistant cloud.""" # Process configs if DOMAIN in config: diff --git a/homeassistant/components/color_extractor/__init__.py b/homeassistant/components/color_extractor/__init__.py index 73e8e09101c..19882937709 100644 --- a/homeassistant/components/color_extractor/__init__.py +++ b/homeassistant/components/color_extractor/__init__.py @@ -15,9 +15,10 @@ from homeassistant.components.light import ( LIGHT_TURN_ON_SCHEMA, SERVICE_TURN_ON as LIGHT_SERVICE_TURN_ON, ) -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import aiohttp_client import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from .const import ATTR_PATH, ATTR_URL, DOMAIN, SERVICE_TURN_ON @@ -56,7 +57,7 @@ def _get_color(file_handler) -> tuple: return color -async def async_setup(hass, hass_config): +async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool: """Set up services for color_extractor integration.""" async def async_handle_service(service_call: ServiceCall) -> None: diff --git a/homeassistant/components/comfoconnect/__init__.py b/homeassistant/components/comfoconnect/__init__.py index 22e39e373e4..6f6f95e478a 100644 --- a/homeassistant/components/comfoconnect/__init__.py +++ b/homeassistant/components/comfoconnect/__init__.py @@ -11,9 +11,11 @@ from homeassistant.const import ( CONF_TOKEN, EVENT_HOMEASSISTANT_STOP, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import dispatcher_send +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -48,7 +50,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the ComfoConnect bridge.""" conf = config[DOMAIN] diff --git a/homeassistant/components/config/__init__.py b/homeassistant/components/config/__init__.py index ff7b1e4d4cd..e67132fef2f 100644 --- a/homeassistant/components/config/__init__.py +++ b/homeassistant/components/config/__init__.py @@ -8,8 +8,9 @@ import voluptuous as vol from homeassistant.components.http import HomeAssistantView from homeassistant.const import CONF_ID, EVENT_COMPONENT_LOADED -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError +from homeassistant.helpers.typing import ConfigType from homeassistant.setup import ATTR_COMPONENT from homeassistant.util.file import write_utf8_file_atomic from homeassistant.util.yaml import dump, load_yaml @@ -33,7 +34,7 @@ ACTION_CREATE_UPDATE = "create_update" ACTION_DELETE = "delete" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the config component.""" hass.components.frontend.async_register_built_in_panel( "config", "config", "hass:cog", require_admin=True diff --git a/homeassistant/components/conversation/__init__.py b/homeassistant/components/conversation/__init__.py index 75bbd4d93aa..a962c039d56 100644 --- a/homeassistant/components/conversation/__init__.py +++ b/homeassistant/components/conversation/__init__.py @@ -8,7 +8,9 @@ import voluptuous as vol from homeassistant import core from homeassistant.components import http, websocket_api from homeassistant.components.http.data_validator import RequestDataValidator +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, intent +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass from .agent import AbstractConversationAgent @@ -51,7 +53,7 @@ def async_set_agent(hass: core.HomeAssistant, agent: AbstractConversationAgent): hass.data[DATA_AGENT] = agent -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Register the process service.""" hass.data[DATA_CONFIG] = config diff --git a/homeassistant/components/coolmaster/__init__.py b/homeassistant/components/coolmaster/__init__.py index fc0040bf245..0f98f8d3afc 100644 --- a/homeassistant/components/coolmaster/__init__.py +++ b/homeassistant/components/coolmaster/__init__.py @@ -4,7 +4,9 @@ import logging from pycoolmasternet_async import CoolMasterNet from homeassistant.components.climate import SCAN_INTERVAL +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_PORT, Platform +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -15,7 +17,7 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = [Platform.CLIMATE] -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Coolmaster from a config entry.""" host = entry.data[CONF_HOST] port = entry.data[CONF_PORT] @@ -38,7 +40,7 @@ async def async_setup_entry(hass, entry): return True -async def async_unload_entry(hass, entry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a Coolmaster config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: diff --git a/homeassistant/components/cover/__init__.py b/homeassistant/components/cover/__init__.py index 506a93461fe..44573c0a6da 100644 --- a/homeassistant/components/cover/__init__.py +++ b/homeassistant/components/cover/__init__.py @@ -34,6 +34,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401 ) from homeassistant.helpers.entity import Entity, EntityDescription from homeassistant.helpers.entity_component import EntityComponent +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass # mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs @@ -99,7 +100,7 @@ def is_closed(hass, entity_id): return hass.states.is_state(entity_id, STATE_CLOSED) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Track states and offer events for covers.""" component = hass.data[DOMAIN] = EntityComponent( _LOGGER, DOMAIN, hass, SCAN_INTERVAL