diff --git a/homeassistant/components/almond/__init__.py b/homeassistant/components/almond/__init__.py index 0dd7a76d4c44..0b5f7ec56b5a 100644 --- a/homeassistant/components/almond/__init__.py +++ b/homeassistant/components/almond/__init__.py @@ -33,6 +33,7 @@ from homeassistant.helpers import ( network, storage, ) +from homeassistant.helpers.typing import ConfigType from . import config_flow from .const import DOMAIN, TYPE_LOCAL, TYPE_OAUTH2 @@ -66,7 +67,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 the Almond component.""" hass.data[DOMAIN] = {} diff --git a/homeassistant/components/aws/__init__.py b/homeassistant/components/aws/__init__.py index 6dcbad748cc3..95b5d4caa32e 100644 --- a/homeassistant/components/aws/__init__.py +++ b/homeassistant/components/aws/__init__.py @@ -13,7 +13,9 @@ from homeassistant.const import ( CONF_PROFILE_NAME, CONF_SERVICE, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, discovery +from homeassistant.helpers.typing import ConfigType # Loading the config flow file will register the flow from .const import ( @@ -81,7 +83,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up AWS component.""" hass.data[DATA_HASS_CONFIG] = config diff --git a/homeassistant/components/configurator/__init__.py b/homeassistant/components/configurator/__init__.py index edd00fec4867..4163ded76434 100644 --- a/homeassistant/components/configurator/__init__.py +++ b/homeassistant/components/configurator/__init__.py @@ -14,8 +14,14 @@ from homeassistant.const import ( ATTR_FRIENDLY_NAME, EVENT_TIME_CHANGED, ) -from homeassistant.core import Event, ServiceCall, callback as async_callback +from homeassistant.core import ( + Event, + HomeAssistant, + ServiceCall, + callback as async_callback, +) from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass from homeassistant.util.async_ import run_callback_threadsafe @@ -123,7 +129,7 @@ def request_done(hass, request_id): ).result() -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the configurator component.""" return True diff --git a/homeassistant/components/hangouts/__init__.py b/homeassistant/components/hangouts/__init__.py index 820aab8cb73e..d26a137237d1 100644 --- a/homeassistant/components/hangouts/__init__.py +++ b/homeassistant/components/hangouts/__init__.py @@ -6,7 +6,9 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components.conversation.util import create_matcher +from homeassistant.config_entries import ConfigEntry from homeassistant.const import EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant from homeassistant.helpers import dispatcher, intent import homeassistant.helpers.config_validation as cv @@ -95,7 +97,7 @@ async def async_setup(hass, config): return True -async def async_setup_entry(hass, config): +async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool: """Set up a config entry.""" try: bot = HangoutsBot( @@ -152,7 +154,7 @@ async def async_setup_entry(hass, config): return True -async def async_unload_entry(hass, _): +async def async_unload_entry(hass: HomeAssistant, _: ConfigEntry) -> bool: """Unload a config entry.""" bot = hass.data[DOMAIN].pop(CONF_BOT) await bot.async_disconnect() diff --git a/homeassistant/components/life360/__init__.py b/homeassistant/components/life360/__init__.py index 75ffffc521e4..96227951527f 100644 --- a/homeassistant/components/life360/__init__.py +++ b/homeassistant/components/life360/__init__.py @@ -9,6 +9,7 @@ from homeassistant.components.device_tracker import ( from homeassistant.components.device_tracker.const import ( SCAN_INTERVAL as DEFAULT_SCAN_INTERVAL, ) +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONF_EXCLUDE, CONF_INCLUDE, @@ -16,6 +17,7 @@ from homeassistant.const import ( CONF_PREFIX, CONF_USERNAME, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv @@ -193,7 +195,7 @@ def setup(hass, config): return True -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up config entry.""" hass.data[DOMAIN]["apis"][entry.data[CONF_USERNAME]] = get_api( entry.data[CONF_AUTHORIZATION] @@ -201,7 +203,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 config entry.""" try: hass.data[DOMAIN]["apis"].pop(entry.data[CONF_USERNAME]) diff --git a/homeassistant/components/logbook/__init__.py b/homeassistant/components/logbook/__init__.py index 6b9c9e6ff263..f4724f793ecf 100644 --- a/homeassistant/components/logbook/__init__.py +++ b/homeassistant/components/logbook/__init__.py @@ -36,6 +36,7 @@ from homeassistant.const import ( ) from homeassistant.core import ( DOMAIN as HA_DOMAIN, + HomeAssistant, ServiceCall, callback, split_entity_id, @@ -50,6 +51,7 @@ from homeassistant.helpers.entityfilter import ( from homeassistant.helpers.integration_platform import ( async_process_integration_platforms, ) +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass import homeassistant.util.dt as dt_util @@ -130,7 +132,7 @@ def async_log_entry(hass, name, message, domain=None, entity_id=None, context=No hass.bus.async_fire(EVENT_LOGBOOK_ENTRY, data, context=context) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Logbook setup.""" hass.data[DOMAIN] = {} diff --git a/homeassistant/components/ps4/__init__.py b/homeassistant/components/ps4/__init__.py index 00310d527354..4c1bb0a0cd72 100644 --- a/homeassistant/components/ps4/__init__.py +++ b/homeassistant/components/ps4/__init__.py @@ -11,6 +11,7 @@ from homeassistant.components.media_player.const import ( ATTR_MEDIA_TITLE, MEDIA_TYPE_GAME, ) +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_COMMAND, ATTR_ENTITY_ID, @@ -22,6 +23,7 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant, ServiceCall, split_entity_id from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_validation as cv, entity_registry +from homeassistant.helpers.typing import ConfigType from homeassistant.util import location from homeassistant.util.json import load_json, save_json @@ -58,7 +60,7 @@ class PS4Data: self.protocol = None -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the PS4 Component.""" hass.data[PS4_DATA] = PS4Data() @@ -69,13 +71,13 @@ async def async_setup(hass, config): return True -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up PS4 from a config entry.""" hass.config_entries.async_setup_platforms(entry, PLATFORMS) return True -async def async_unload_entry(hass, entry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a PS4 config entry.""" return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/shopping_list/__init__.py b/homeassistant/components/shopping_list/__init__.py index 348dba00a1e8..34ad95a250cc 100644 --- a/homeassistant/components/shopping_list/__init__.py +++ b/homeassistant/components/shopping_list/__init__.py @@ -9,8 +9,9 @@ from homeassistant import config_entries from homeassistant.components import http, websocket_api from homeassistant.components.http.data_validator import RequestDataValidator from homeassistant.const import ATTR_NAME -from homeassistant.core import ServiceCall, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util.json import load_json, save_json from .const import ( @@ -61,7 +62,7 @@ SCHEMA_WEBSOCKET_CLEAR_ITEMS = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize the shopping list.""" if DOMAIN not in config: diff --git a/homeassistant/components/tibber/__init__.py b/homeassistant/components/tibber/__init__.py index 57d95855ccab..00d8d4aa3a2c 100644 --- a/homeassistant/components/tibber/__init__.py +++ b/homeassistant/components/tibber/__init__.py @@ -5,16 +5,19 @@ import logging import aiohttp import tibber +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONF_ACCESS_TOKEN, CONF_NAME, EVENT_HOMEASSISTANT_STOP, Platform, ) +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import discovery from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.util import dt as dt_util from .const import DATA_HASS_CONFIG, DOMAIN @@ -26,14 +29,14 @@ CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False) _LOGGER = logging.getLogger(__name__) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Tibber component.""" hass.data[DATA_HASS_CONFIG] = config return True -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up a config entry.""" tibber_connection = tibber.Tibber( diff --git a/homeassistant/components/zabbix/__init__.py b/homeassistant/components/zabbix/__init__.py index 82807c4aceef..21c3edd56bf7 100644 --- a/homeassistant/components/zabbix/__init__.py +++ b/homeassistant/components/zabbix/__init__.py @@ -23,13 +23,14 @@ from homeassistant.const import ( STATE_UNAVAILABLE, 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 import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entityfilter import ( INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA, convert_include_exclude_filter, ) +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -65,7 +66,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Zabbix component.""" conf = config[DOMAIN]