diff --git a/homeassistant/components/daikin/__init__.py b/homeassistant/components/daikin/__init__.py index 95189774a8173..dcdc924fb4a67 100644 --- a/homeassistant/components/daikin/__init__.py +++ b/homeassistant/components/daikin/__init__.py @@ -50,7 +50,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.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: diff --git a/homeassistant/components/danfoss_air/__init__.py b/homeassistant/components/danfoss_air/__init__.py index e98545fe1b201..599edbb770304 100644 --- a/homeassistant/components/danfoss_air/__init__.py +++ b/homeassistant/components/danfoss_air/__init__.py @@ -7,8 +7,10 @@ import voluptuous as vol from homeassistant.const import CONF_HOST, 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__) @@ -23,7 +25,7 @@ ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Danfoss Air component.""" conf = config[DOMAIN] diff --git a/homeassistant/components/datadog/__init__.py b/homeassistant/components/datadog/__init__.py index 5d3aae3de2034..47a2d34ec8e87 100644 --- a/homeassistant/components/datadog/__init__.py +++ b/homeassistant/components/datadog/__init__.py @@ -12,8 +12,10 @@ EVENT_STATE_CHANGED, STATE_UNKNOWN, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import state as state_helper import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -41,7 +43,7 @@ ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Datadog component.""" conf = config[DOMAIN] diff --git a/homeassistant/components/default_config/__init__.py b/homeassistant/components/default_config/__init__.py index 506904a500af6..9e6ab26817204 100644 --- a/homeassistant/components/default_config/__init__.py +++ b/homeassistant/components/default_config/__init__.py @@ -1,15 +1,18 @@ """Component providing default configuration for new users.""" + try: import av except ImportError: av = None +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from homeassistant.setup import async_setup_component DOMAIN = "default_config" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize default configuration.""" if av is None: return True diff --git a/homeassistant/components/demo/__init__.py b/homeassistant/components/demo/__init__.py index 3a1fbff2f87f7..5ac1945c18573 100644 --- a/homeassistant/components/demo/__init__.py +++ b/homeassistant/components/demo/__init__.py @@ -8,12 +8,15 @@ async_add_external_statistics, get_last_statistics, ) +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_START, SOUND_PRESSURE_DB, ) import homeassistant.core as ha +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util DOMAIN = "demo" @@ -51,7 +54,7 @@ ] -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the demo environment.""" if DOMAIN not in config: return True @@ -249,7 +252,7 @@ async def _insert_statistics(hass): async_add_external_statistics(hass, metadata, statistics) -async def async_setup_entry(hass, config_entry): +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set the config entry up.""" # Set up demo platforms with config entry for platform in COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM: diff --git a/homeassistant/components/device_automation/__init__.py b/homeassistant/components/device_automation/__init__.py index 67ef17dc3792c..3d16290d325da 100644 --- a/homeassistant/components/device_automation/__init__.py +++ b/homeassistant/components/device_automation/__init__.py @@ -21,6 +21,7 @@ entity_registry as er, ) from homeassistant.helpers.frame import report +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import IntegrationNotFound, bind_hass from homeassistant.requirements import async_get_integration_with_requirements @@ -93,7 +94,7 @@ async def async_get_device_automations( return await _async_get_device_automations(hass, automation_type, device_ids) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up device automation.""" hass.components.websocket_api.async_register_command( websocket_device_automation_list_actions diff --git a/homeassistant/components/device_sun_light_trigger/__init__.py b/homeassistant/components/device_sun_light_trigger/__init__.py index cb3c10dae7544..a78b34320160a 100644 --- a/homeassistant/components/device_sun_light_trigger/__init__.py +++ b/homeassistant/components/device_sun_light_trigger/__init__.py @@ -19,13 +19,14 @@ SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import ( async_track_point_in_utc_time, async_track_state_change, ) from homeassistant.helpers.sun import get_astral_event_next, is_up +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util DOMAIN = "device_sun_light_trigger" @@ -58,7 +59,7 @@ ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the triggers to control lights based on device presence.""" conf = config[DOMAIN] disable_turn_off = conf[CONF_DISABLE_TURN_OFF] diff --git a/homeassistant/components/dialogflow/__init__.py b/homeassistant/components/dialogflow/__init__.py index 9473fd537addf..62d84282511e4 100644 --- a/homeassistant/components/dialogflow/__init__.py +++ b/homeassistant/components/dialogflow/__init__.py @@ -4,7 +4,9 @@ from aiohttp import web import voluptuous as vol +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_WEBHOOK_ID +from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_entry_flow, intent, template @@ -61,7 +63,7 @@ async def handle_webhook(hass, webhook_id, request): ) -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Configure based on config entry.""" hass.components.webhook.async_register( DOMAIN, "DialogFlow", entry.data[CONF_WEBHOOK_ID], handle_webhook @@ -69,7 +71,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 config entry.""" hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID]) return True diff --git a/homeassistant/components/digital_ocean/__init__.py b/homeassistant/components/digital_ocean/__init__.py index 194841da66229..ed951fa2aa4ea 100644 --- a/homeassistant/components/digital_ocean/__init__.py +++ b/homeassistant/components/digital_ocean/__init__.py @@ -6,7 +6,9 @@ import voluptuous as vol from homeassistant.const import CONF_ACCESS_TOKEN, Platform +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -37,7 +39,7 @@ ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Digital Ocean component.""" conf = config[DOMAIN] diff --git a/homeassistant/components/discovery/__init__.py b/homeassistant/components/discovery/__init__.py index 595771cd67394..fb7ac2b270dc6 100644 --- a/homeassistant/components/discovery/__init__.py +++ b/homeassistant/components/discovery/__init__.py @@ -12,10 +12,11 @@ from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.const import EVENT_HOMEASSISTANT_STARTED -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_discover, async_load_platform from homeassistant.helpers.event import async_track_point_in_utc_time +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import async_get_zeroconf import homeassistant.util.dt as dt_util @@ -124,7 +125,7 @@ class ServiceDetails(NamedTuple): ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Start a discovery service.""" logger = logging.getLogger(__name__) diff --git a/homeassistant/components/dominos/__init__.py b/homeassistant/components/dominos/__init__.py index d39773842552e..b194e8dc908ac 100644 --- a/homeassistant/components/dominos/__init__.py +++ b/homeassistant/components/dominos/__init__.py @@ -7,10 +7,11 @@ import voluptuous as vol from homeassistant.components import http -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent +from homeassistant.helpers.typing import ConfigType from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -62,7 +63,7 @@ ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up is called when Home Assistant is loading our component.""" dominos = Dominos(hass, config) diff --git a/homeassistant/components/dovado/__init__.py b/homeassistant/components/dovado/__init__.py index 8e4c712e8b4b1..40069a769a112 100644 --- a/homeassistant/components/dovado/__init__.py +++ b/homeassistant/components/dovado/__init__.py @@ -12,7 +12,9 @@ CONF_USERNAME, DEVICE_DEFAULT_NAME, ) +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -36,7 +38,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Dovado component.""" hass.data[DOMAIN] = DovadoData( diff --git a/homeassistant/components/downloader/__init__.py b/homeassistant/components/downloader/__init__.py index 0adfeaeb94517..9aca80b04da35 100644 --- a/homeassistant/components/downloader/__init__.py +++ b/homeassistant/components/downloader/__init__.py @@ -8,8 +8,9 @@ import requests import voluptuous as vol -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path _LOGGER = logging.getLogger(__name__) @@ -42,7 +43,7 @@ ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Listen for download events to download files.""" download_path = config[DOMAIN][CONF_DOWNLOAD_DIR] diff --git a/homeassistant/components/duckdns/__init__.py b/homeassistant/components/duckdns/__init__.py index 42f36c5435f25..88b7a676accd9 100644 --- a/homeassistant/components/duckdns/__init__.py +++ b/homeassistant/components/duckdns/__init__.py @@ -5,10 +5,11 @@ import voluptuous as vol from homeassistant.const import CONF_ACCESS_TOKEN, CONF_DOMAIN -from homeassistant.core import CALLBACK_TYPE, ServiceCall, callback +from homeassistant.core import CALLBACK_TYPE, HomeAssistant, ServiceCall, callback from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_call_later +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass from homeassistant.util import dt as dt_util @@ -39,7 +40,7 @@ SERVICE_TXT_SCHEMA = vol.Schema({vol.Required(ATTR_TXT): vol.Any(None, cv.string)}) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize the DuckDNS component.""" domain = config[DOMAIN][CONF_DOMAIN] token = config[DOMAIN][CONF_ACCESS_TOKEN] diff --git a/homeassistant/components/dweet/__init__.py b/homeassistant/components/dweet/__init__.py index c076fc81628bb..eb809ff47dfb9 100644 --- a/homeassistant/components/dweet/__init__.py +++ b/homeassistant/components/dweet/__init__.py @@ -12,8 +12,10 @@ EVENT_STATE_CHANGED, STATE_UNKNOWN, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import state as state_helper import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -37,7 +39,7 @@ ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Dweet.io component.""" conf = config[DOMAIN] name = conf.get(CONF_NAME)