From 16503321882a4dec2705d3deeb800b1790dbefd5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sun, 2 Jan 2022 16:31:48 +0100 Subject: [PATCH] Add init type hints [h-j] (#63187) Co-authored-by: epenet --- homeassistant/components/hisense_aehw4a1/__init__.py | 9 ++++++--- homeassistant/components/hive/__init__.py | 9 ++++++--- homeassistant/components/hlk_sw16/__init__.py | 11 ++++++----- homeassistant/components/homekit/__init__.py | 2 +- homeassistant/components/homematic/__init__.py | 5 +++-- homeassistant/components/honeywell/__init__.py | 6 ++++-- homeassistant/components/hydrawise/__init__.py | 5 +++-- homeassistant/components/icloud/__init__.py | 1 - homeassistant/components/ifttt/__init__.py | 10 ++++++---- homeassistant/components/image_processing/__init__.py | 5 +++-- homeassistant/components/incomfort/__init__.py | 5 +++-- homeassistant/components/influxdb/__init__.py | 5 +++-- homeassistant/components/insteon/__init__.py | 8 +++++--- homeassistant/components/intent_script/__init__.py | 4 +++- homeassistant/components/iperf3/__init__.py | 5 +++-- homeassistant/components/ipma/__init__.py | 6 ++++-- .../components/islamic_prayer_times/__init__.py | 10 ++++++---- homeassistant/components/izone/__init__.py | 5 +++-- homeassistant/components/joaoapps_join/__init__.py | 5 +++-- 19 files changed, 71 insertions(+), 45 deletions(-) diff --git a/homeassistant/components/hisense_aehw4a1/__init__.py b/homeassistant/components/hisense_aehw4a1/__init__.py index bc38d1df53f..74eb4371614 100644 --- a/homeassistant/components/hisense_aehw4a1/__init__.py +++ b/homeassistant/components/hisense_aehw4a1/__init__.py @@ -8,8 +8,11 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_IP_ADDRESS, Platform +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from .const import DOMAIN @@ -45,7 +48,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Hisense AEH-W4A1 integration.""" conf = config.get(DOMAIN) hass.data[DOMAIN] = {} @@ -70,12 +73,12 @@ 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 a config entry for Hisense AEH-W4A1.""" 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.""" return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/hive/__init__.py b/homeassistant/components/hive/__init__.py index aa05daf8e58..fab89bd5b19 100644 --- a/homeassistant/components/hive/__init__.py +++ b/homeassistant/components/hive/__init__.py @@ -8,7 +8,9 @@ from apyhiveapi.helper.hive_exceptions import HiveReauthRequired import voluptuous as vol from homeassistant import config_entries +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers import aiohttp_client, config_validation as cv from homeassistant.helpers.dispatcher import ( @@ -16,6 +18,7 @@ from homeassistant.helpers.dispatcher import ( async_dispatcher_send, ) from homeassistant.helpers.entity import Entity +from homeassistant.helpers.typing import ConfigType from .const import DOMAIN, PLATFORM_LOOKUP, PLATFORMS @@ -38,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Hive configuration setup.""" hass.data[DOMAIN] = {} @@ -61,7 +64,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 Hive from a config entry.""" websession = aiohttp_client.async_get_clientsession(hass) @@ -92,7 +95,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) if unload_ok: diff --git a/homeassistant/components/hlk_sw16/__init__.py b/homeassistant/components/hlk_sw16/__init__.py index 9fae14f8d1a..ddd9c5da359 100644 --- a/homeassistant/components/hlk_sw16/__init__.py +++ b/homeassistant/components/hlk_sw16/__init__.py @@ -4,15 +4,16 @@ import logging from hlk_sw16 import create_hlk_sw16_connection import voluptuous as vol -from homeassistant.config_entries import SOURCE_IMPORT +from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_SWITCHES, Platform -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, async_dispatcher_send, ) from homeassistant.helpers.entity import Entity +from homeassistant.helpers.typing import ConfigType from .const import ( CONNECTION_TIMEOUT, @@ -55,7 +56,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Component setup, do nothing.""" if DOMAIN not in config: return True @@ -72,7 +73,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 the HLK-SW16 switch.""" hass.data.setdefault(DOMAIN, {}) host = entry.data[CONF_HOST] @@ -122,7 +123,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.""" client = hass.data[DOMAIN][entry.entry_id].pop(DATA_DEVICE_REGISTER) client.stop() diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 00f5e82432d..2f2053aa83e 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -338,7 +338,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return True -async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry): +async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: """Remove a config entry.""" return await hass.async_add_executor_job( remove_state_files_for_entry_id, hass, entry.entry_id diff --git a/homeassistant/components/homematic/__init__.py b/homeassistant/components/homematic/__init__.py index 8e2f2b2b3fe..364bfd11210 100644 --- a/homeassistant/components/homematic/__init__.py +++ b/homeassistant/components/homematic/__init__.py @@ -22,9 +22,10 @@ from homeassistant.const import ( CONF_VERIFY_SSL, EVENT_HOMEASSISTANT_STOP, ) -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 from .const import ( ATTR_ADDRESS, @@ -208,7 +209,7 @@ SCHEMA_SERVICE_PUT_PARAMSET = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Homematic component.""" conf = config[DOMAIN] hass.data[DATA_CONF] = remotes = {} diff --git a/homeassistant/components/honeywell/__init__.py b/homeassistant/components/honeywell/__init__.py index 4f3f27360f8..68a005c5f72 100644 --- a/homeassistant/components/honeywell/__init__.py +++ b/homeassistant/components/honeywell/__init__.py @@ -4,7 +4,9 @@ from datetime import timedelta import somecomfort +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.util import Throttle @@ -15,7 +17,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300) PLATFORMS = [Platform.CLIMATE] -async def async_setup_entry(hass, config): +async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool: """Set up the Honeywell thermostat.""" username = config.data[CONF_USERNAME] password = config.data[CONF_PASSWORD] @@ -58,7 +60,7 @@ async def update_listener(hass, config) -> None: await hass.config_entries.async_reload(config.entry_id) -async def async_unload_entry(hass, config): +async def async_unload_entry(hass: HomeAssistant, config: ConfigEntry) -> bool: """Unload the config config and platforms.""" unload_ok = await hass.config_entries.async_unload_platforms(config, PLATFORMS) if unload_ok: diff --git a/homeassistant/components/hydrawise/__init__.py b/homeassistant/components/hydrawise/__init__.py index 56ebdc0d88c..12afcd7ff80 100644 --- a/homeassistant/components/hydrawise/__init__.py +++ b/homeassistant/components/hydrawise/__init__.py @@ -7,11 +7,12 @@ from requests.exceptions import ConnectTimeout, HTTPError import voluptuous as vol from homeassistant.const import ATTR_ATTRIBUTION, CONF_ACCESS_TOKEN, CONF_SCAN_INTERVAL -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send from homeassistant.helpers.entity import Entity, EntityDescription from homeassistant.helpers.event import track_time_interval +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -45,7 +46,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Hunter Hydrawise component.""" conf = config[DOMAIN] access_token = conf[CONF_ACCESS_TOKEN] diff --git a/homeassistant/components/icloud/__init__.py b/homeassistant/components/icloud/__init__.py index 5340ff8a4fb..af263e3b1ea 100644 --- a/homeassistant/components/icloud/__init__.py +++ b/homeassistant/components/icloud/__init__.py @@ -1,5 +1,4 @@ """The iCloud component.""" - import voluptuous as vol from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry diff --git a/homeassistant/components/ifttt/__init__.py b/homeassistant/components/ifttt/__init__.py index a9c682d40ad..1477da00980 100644 --- a/homeassistant/components/ifttt/__init__.py +++ b/homeassistant/components/ifttt/__init__.py @@ -7,10 +7,12 @@ import pyfttt import requests import voluptuous as vol +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_WEBHOOK_ID -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import config_entry_flow import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from .const import DOMAIN @@ -49,7 +51,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the IFTTT service component.""" if DOMAIN not in config: return True @@ -111,7 +113,7 @@ async def handle_webhook(hass, webhook_id, request): hass.bus.async_fire(EVENT_RECEIVED, data) -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, "IFTTT", entry.data[CONF_WEBHOOK_ID], handle_webhook @@ -119,7 +121,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/image_processing/__init__.py b/homeassistant/components/image_processing/__init__.py index b2f9e339757..5c932826197 100644 --- a/homeassistant/components/image_processing/__init__.py +++ b/homeassistant/components/image_processing/__init__.py @@ -13,12 +13,13 @@ from homeassistant.const import ( CONF_NAME, CONF_SOURCE, ) -from homeassistant.core import ServiceCall, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.config_validation import make_entity_service_schema from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent +from homeassistant.helpers.typing import ConfigType from homeassistant.util.async_ import run_callback_threadsafe # mypy: allow-untyped-defs, no-check-untyped-defs @@ -69,7 +70,7 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend( PLATFORM_SCHEMA_BASE = cv.PLATFORM_SCHEMA_BASE.extend(PLATFORM_SCHEMA.schema) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the image processing.""" component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL) diff --git a/homeassistant/components/incomfort/__init__.py b/homeassistant/components/incomfort/__init__.py index 9d14703fa32..0d255d84cce 100644 --- a/homeassistant/components/incomfort/__init__.py +++ b/homeassistant/components/incomfort/__init__.py @@ -8,12 +8,13 @@ from incomfortclient import Gateway as InComfortGateway import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback 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.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -33,7 +34,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, hass_config): +async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool: """Create an Intergas InComfort/Intouch system.""" incomfort_data = hass.data[DOMAIN] = {} diff --git a/homeassistant/components/influxdb/__init__.py b/homeassistant/components/influxdb/__init__.py index 407036e327c..d07e64ae83a 100644 --- a/homeassistant/components/influxdb/__init__.py +++ b/homeassistant/components/influxdb/__init__.py @@ -30,7 +30,7 @@ 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.entity_values import EntityValues @@ -38,6 +38,7 @@ from homeassistant.helpers.entityfilter import ( INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA, convert_include_exclude_filter, ) +from homeassistant.helpers.typing import ConfigType from .const import ( API_VERSION_2, @@ -468,7 +469,7 @@ def get_influx_connection(conf, test_write=False, test_read=False): # noqa: C90 return InfluxClient(databases, write_v1, query_v1, close_v1) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the InfluxDB component.""" conf = config[DOMAIN] try: diff --git a/homeassistant/components/insteon/__init__.py b/homeassistant/components/insteon/__init__.py index e9be0d22cb8..0f17e1231e4 100644 --- a/homeassistant/components/insteon/__init__.py +++ b/homeassistant/components/insteon/__init__.py @@ -5,9 +5,11 @@ import logging from pyinsteon import async_close, async_connect, devices -from homeassistant.config_entries import SOURCE_IMPORT +from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady +from homeassistant.helpers.typing import ConfigType from . import api from .const import ( @@ -70,7 +72,7 @@ async def close_insteon_connection(*args): await async_close() -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Insteon platform.""" if DOMAIN not in config: return True @@ -89,7 +91,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 an Insteon entry.""" if not devices.modem: diff --git a/homeassistant/components/intent_script/__init__.py b/homeassistant/components/intent_script/__init__.py index ffa622307fd..2deca297f34 100644 --- a/homeassistant/components/intent_script/__init__.py +++ b/homeassistant/components/intent_script/__init__.py @@ -4,7 +4,9 @@ import copy import voluptuous as vol from homeassistant.const import CONF_TYPE +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, intent, script, template +from homeassistant.helpers.typing import ConfigType DOMAIN = "intent_script" @@ -44,7 +46,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Activate Alexa component.""" intents = copy.deepcopy(config[DOMAIN]) template.attach(hass, intents) diff --git a/homeassistant/components/iperf3/__init__.py b/homeassistant/components/iperf3/__init__.py index 14b1b37c005..8e7e365813e 100644 --- a/homeassistant/components/iperf3/__init__.py +++ b/homeassistant/components/iperf3/__init__.py @@ -20,11 +20,12 @@ from homeassistant.const import ( CONF_SCAN_INTERVAL, DATA_RATE_MEGABITS_PER_SECOND, ) -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.event import async_track_time_interval +from homeassistant.helpers.typing import ConfigType DOMAIN = "iperf3" DATA_UPDATED = f"{DOMAIN}_data_updated" @@ -93,7 +94,7 @@ CONFIG_SCHEMA = vol.Schema( SERVICE_SCHEMA = vol.Schema({vol.Optional(ATTR_HOST, default=None): cv.string}) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the iperf3 component.""" hass.data[DOMAIN] = {} diff --git a/homeassistant/components/ipma/__init__.py b/homeassistant/components/ipma/__init__.py index f24f8104bd8..1bd948ffa5e 100644 --- a/homeassistant/components/ipma/__init__.py +++ b/homeassistant/components/ipma/__init__.py @@ -1,5 +1,7 @@ """Component for the Portuguese weather service - IPMA.""" +from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform +from homeassistant.core import HomeAssistant from .config_flow import IpmaFlowHandler # noqa: F401 from .const import DOMAIN # noqa: F401 @@ -9,12 +11,12 @@ DEFAULT_NAME = "ipma" PLATFORMS = [Platform.WEATHER] -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up IPMA station as 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.""" return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/islamic_prayer_times/__init__.py b/homeassistant/components/islamic_prayer_times/__init__.py index a55838970fe..5aaa243282b 100644 --- a/homeassistant/components/islamic_prayer_times/__init__.py +++ b/homeassistant/components/islamic_prayer_times/__init__.py @@ -6,12 +6,14 @@ from prayer_times_calculator import PrayerTimesCalculator, exceptions from requests.exceptions import ConnectionError as ConnError import voluptuous as vol -from homeassistant.config_entries import SOURCE_IMPORT +from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import Platform +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.event import async_call_later, async_track_point_in_time +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util from .const import ( @@ -41,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Import the Islamic Prayer component from config.""" if DOMAIN in config: hass.async_create_task( @@ -53,7 +55,7 @@ async def async_setup(hass, config): return True -async def async_setup_entry(hass, config_entry): +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up the Islamic Prayer Component.""" client = IslamicPrayerClient(hass, config_entry) @@ -64,7 +66,7 @@ async def async_setup_entry(hass, config_entry): return True -async def async_unload_entry(hass, config_entry): +async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Unload Islamic Prayer entry from config_entry.""" if hass.data[DOMAIN].event_unsub: hass.data[DOMAIN].event_unsub() diff --git a/homeassistant/components/izone/__init__.py b/homeassistant/components/izone/__init__.py index d49de8c0e55..0aef8360bdd 100644 --- a/homeassistant/components/izone/__init__.py +++ b/homeassistant/components/izone/__init__.py @@ -2,6 +2,7 @@ import voluptuous as vol from homeassistant import config_entries +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_EXCLUDE, Platform from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -43,14 +44,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: return True -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up from a config entry.""" await async_start_discovery_service(hass) 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 the config entry and stop discovery process.""" await async_stop_discovery_service(hass) return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/joaoapps_join/__init__.py b/homeassistant/components/joaoapps_join/__init__.py index dac6770f373..b53855c79fb 100644 --- a/homeassistant/components/joaoapps_join/__init__.py +++ b/homeassistant/components/joaoapps_join/__init__.py @@ -13,8 +13,9 @@ from pyjoin import ( import voluptuous as vol from homeassistant.const import CONF_API_KEY, CONF_DEVICE_ID, CONF_NAME -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -113,7 +114,7 @@ def register_device(hass, api_key, name, device_id, device_ids, device_names): hass.services.register(DOMAIN, f"{name}send_tasker", send_tasker_service) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Join services.""" for device in config[DOMAIN]: api_key = device.get(CONF_API_KEY)