diff --git a/homeassistant/components/kaiterra/__init__.py b/homeassistant/components/kaiterra/__init__.py index eae14bd330e..6cf866d2d63 100644 --- a/homeassistant/components/kaiterra/__init__.py +++ b/homeassistant/components/kaiterra/__init__.py @@ -9,10 +9,12 @@ from homeassistant.const import ( CONF_SCAN_INTERVAL, CONF_TYPE, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.event import async_track_time_interval +from homeassistant.helpers.typing import ConfigType from .api_data import KaiterraApiData from .const import ( @@ -53,7 +55,7 @@ KAITERRA_SCHEMA = vol.Schema( CONFIG_SCHEMA = vol.Schema({DOMAIN: KAITERRA_SCHEMA}, extra=vol.ALLOW_EXTRA) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Kaiterra integration.""" conf = config[DOMAIN] diff --git a/homeassistant/components/keba/__init__.py b/homeassistant/components/keba/__init__.py index 6d80019ffd7..a754321331a 100644 --- a/homeassistant/components/keba/__init__.py +++ b/homeassistant/components/keba/__init__.py @@ -6,9 +6,10 @@ from keba_kecontact.connection import KebaKeContact import voluptuous as vol from homeassistant.const import CONF_HOST -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -54,7 +55,7 @@ _SERVICE_MAP = { } -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Check connectivity and version of KEBA charging station.""" host = config[DOMAIN][CONF_HOST] rfid = config[DOMAIN][CONF_RFID] diff --git a/homeassistant/components/keyboard/__init__.py b/homeassistant/components/keyboard/__init__.py index 0c5acf5b593..cdd80119bc5 100644 --- a/homeassistant/components/keyboard/__init__.py +++ b/homeassistant/components/keyboard/__init__.py @@ -10,13 +10,15 @@ from homeassistant.const import ( SERVICE_VOLUME_MUTE, SERVICE_VOLUME_UP, ) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType DOMAIN = "keyboard" TAP_KEY_SCHEMA = vol.Schema({}) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Listen for keyboard events.""" keyboard = PyKeyboard() diff --git a/homeassistant/components/kira/__init__.py b/homeassistant/components/kira/__init__.py index 01e584922b6..c54b8a91208 100644 --- a/homeassistant/components/kira/__init__.py +++ b/homeassistant/components/kira/__init__.py @@ -19,8 +19,10 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType DOMAIN = "kira" @@ -92,7 +94,7 @@ def load_codes(path): return codes -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the KIRA component.""" sensors = config.get(DOMAIN, {}).get(CONF_SENSORS, []) remotes = config.get(DOMAIN, {}).get(CONF_REMOTES, []) diff --git a/homeassistant/components/lametric/__init__.py b/homeassistant/components/lametric/__init__.py index f51a34aafc1..f0384e457e4 100644 --- a/homeassistant/components/lametric/__init__.py +++ b/homeassistant/components/lametric/__init__.py @@ -5,7 +5,9 @@ from lmnotify import LaMetricManager import voluptuous as vol from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType _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 LaMetricManager.""" _LOGGER.debug("Setting up LaMetric platform") conf = config[DOMAIN] diff --git a/homeassistant/components/lifx/__init__.py b/homeassistant/components/lifx/__init__.py index 6d967ea9c69..df672c07143 100644 --- a/homeassistant/components/lifx/__init__.py +++ b/homeassistant/components/lifx/__init__.py @@ -3,8 +3,11 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PORT, Platform +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from .const import DOMAIN @@ -29,7 +32,7 @@ DATA_LIFX_MANAGER = "lifx_manager" PLATFORMS = [Platform.LIGHT] -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the LIFX component.""" conf = config.get(DOMAIN) @@ -45,13 +48,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 LIFX 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 config entry.""" hass.data.pop(DATA_LIFX_MANAGER).cleanup() return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 3156306554c..ad83f8c55a5 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -27,6 +27,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401 ) from homeassistant.helpers.entity import ToggleEntity, ToggleEntityDescription from homeassistant.helpers.entity_component import EntityComponent +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass import homeassistant.util.color as color_util @@ -316,7 +317,7 @@ def filter_turn_on_params(light, params): return params -async def async_setup(hass, config): # noqa: C901 +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: C901 """Expose light control via state machine and services.""" component = hass.data[DOMAIN] = EntityComponent( _LOGGER, DOMAIN, hass, SCAN_INTERVAL diff --git a/homeassistant/components/lightwave/__init__.py b/homeassistant/components/lightwave/__init__.py index 9cd73d8ffea..3f960e850b6 100644 --- a/homeassistant/components/lightwave/__init__.py +++ b/homeassistant/components/lightwave/__init__.py @@ -5,8 +5,10 @@ import voluptuous as vol from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.const import CONF_HOST, CONF_LIGHTS, CONF_NAME, CONF_SWITCHES +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_load_platform +from homeassistant.helpers.typing import ConfigType CONF_SERIAL = "serial" CONF_PROXY_IP = "proxy_ip" @@ -58,7 +60,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Try to start embedded Lightwave broker.""" host = config[DOMAIN][CONF_HOST] lwlink = LWLink(host) diff --git a/homeassistant/components/linode/__init__.py b/homeassistant/components/linode/__init__.py index 0a72768da7d..bd61519edc4 100644 --- a/homeassistant/components/linode/__init__.py +++ b/homeassistant/components/linode/__init__.py @@ -6,7 +6,9 @@ import linode 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__) @@ -34,7 +36,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Linode component.""" conf = config[DOMAIN] access_token = conf.get(CONF_ACCESS_TOKEN) diff --git a/homeassistant/components/lirc/__init__.py b/homeassistant/components/lirc/__init__.py index b52cf3cf107..cca7593768b 100644 --- a/homeassistant/components/lirc/__init__.py +++ b/homeassistant/components/lirc/__init__.py @@ -7,6 +7,8 @@ import time import lirc from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -19,7 +21,7 @@ EVENT_IR_COMMAND_RECEIVED = "ir_command_received" ICON = "mdi:remote" -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the LIRC capability.""" # blocking=True gives unexpected behavior (multiple responses for 1 press) # also by not blocking, we allow hass to shut down the thread gracefully diff --git a/homeassistant/components/litejet/__init__.py b/homeassistant/components/litejet/__init__.py index 2da02368e93..d854e922ebd 100644 --- a/homeassistant/components/litejet/__init__.py +++ b/homeassistant/components/litejet/__init__.py @@ -10,6 +10,7 @@ from homeassistant.const import CONF_PORT from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from .const import CONF_EXCLUDE_NAMES, CONF_INCLUDE_SWITCHES, DOMAIN, PLATFORMS @@ -34,7 +35,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the LiteJet component.""" if DOMAIN in config and not hass.config_entries.async_entries(DOMAIN): # No config entry exists and configuration.yaml config exists, trigger the import flow. diff --git a/homeassistant/components/locative/__init__.py b/homeassistant/components/locative/__init__.py index ec61cbbcdc7..90b62fd833e 100644 --- a/homeassistant/components/locative/__init__.py +++ b/homeassistant/components/locative/__init__.py @@ -7,6 +7,7 @@ import logging from aiohttp import web import voluptuous as vol +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_ID, ATTR_LATITUDE, @@ -15,9 +16,11 @@ from homeassistant.const import ( STATE_NOT_HOME, Platform, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -57,7 +60,7 @@ WEBHOOK_SCHEMA = vol.All( ) -async def async_setup(hass, hass_config): +async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool: """Set up the Locative component.""" hass.data[DOMAIN] = {"devices": set(), "unsub_device_tracker": {}} return True @@ -111,7 +114,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, "Locative", entry.data[CONF_WEBHOOK_ID], handle_webhook @@ -121,7 +124,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]) hass.data[DOMAIN]["unsub_device_tracker"].pop(entry.entry_id)() diff --git a/homeassistant/components/logentries/__init__.py b/homeassistant/components/logentries/__init__.py index 9390bde240a..fc7a30de762 100644 --- a/homeassistant/components/logentries/__init__.py +++ b/homeassistant/components/logentries/__init__.py @@ -6,8 +6,10 @@ import requests import voluptuous as vol from homeassistant.const import CONF_TOKEN, EVENT_STATE_CHANGED +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__) @@ -20,7 +22,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Logentries component.""" conf = config[DOMAIN] token = conf.get(CONF_TOKEN) diff --git a/homeassistant/components/logger/__init__.py b/homeassistant/components/logger/__init__.py index ac71ee2944b..2b8bec957fa 100644 --- a/homeassistant/components/logger/__init__.py +++ b/homeassistant/components/logger/__init__.py @@ -3,8 +3,9 @@ import logging import voluptuous as vol -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 DOMAIN = "logger" @@ -49,7 +50,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the logger component.""" hass.data[DOMAIN] = {} logging.setLoggerClass(_get_logger_class(hass.data[DOMAIN])) diff --git a/homeassistant/components/logi_circle/__init__.py b/homeassistant/components/logi_circle/__init__.py index 6d294636ede..1b193c33554 100644 --- a/homeassistant/components/logi_circle/__init__.py +++ b/homeassistant/components/logi_circle/__init__.py @@ -9,6 +9,7 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components.camera import ATTR_FILENAME +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_MODE, @@ -20,9 +21,10 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP, Platform, ) -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.helpers.typing import ConfigType from . import config_flow from .const import ( @@ -101,7 +103,7 @@ LOGI_CIRCLE_SERVICE_RECORD = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up configured Logi Circle component.""" if DOMAIN not in config: return True @@ -127,7 +129,7 @@ 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 Logi Circle from a config entry.""" logi_circle = LogiCircle( client_id=entry.data[CONF_CLIENT_ID], @@ -228,7 +230,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.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/lupusec/__init__.py b/homeassistant/components/lupusec/__init__.py index 54fbf98c9a1..25f8d0a0731 100644 --- a/homeassistant/components/lupusec/__init__.py +++ b/homeassistant/components/lupusec/__init__.py @@ -13,8 +13,10 @@ from homeassistant.const import ( CONF_USERNAME, Platform, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, discovery from homeassistant.helpers.entity import Entity +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -44,7 +46,7 @@ LUPUSEC_PLATFORMS = [ ] -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up Lupusec component.""" conf = config[DOMAIN] username = conf[CONF_USERNAME] diff --git a/homeassistant/components/lutron_caseta/__init__.py b/homeassistant/components/lutron_caseta/__init__.py index d91dc8f31e5..d73e03b44d4 100644 --- a/homeassistant/components/lutron_caseta/__init__.py +++ b/homeassistant/components/lutron_caseta/__init__.py @@ -18,6 +18,7 @@ from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import DeviceInfo, Entity +from homeassistant.helpers.typing import ConfigType from .const import ( ACTION_PRESS, @@ -77,7 +78,7 @@ PLATFORMS = [ ] -async def async_setup(hass, base_config): +async def async_setup(hass: HomeAssistant, base_config: ConfigType) -> bool: """Set up the Lutron component.""" hass.data.setdefault(DOMAIN, {})