diff --git a/homeassistant/components/namecheapdns/__init__.py b/homeassistant/components/namecheapdns/__init__.py index fbc78f622a1..84f995c947a 100644 --- a/homeassistant/components/namecheapdns/__init__.py +++ b/homeassistant/components/namecheapdns/__init__.py @@ -6,9 +6,11 @@ import defusedxml.ElementTree as ET import voluptuous as vol from homeassistant.const import CONF_DOMAIN, CONF_HOST, CONF_PASSWORD +from homeassistant.core import HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_time_interval +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -32,7 +34,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize the namecheap DNS component.""" host = config[DOMAIN][CONF_HOST] domain = config[DOMAIN][CONF_DOMAIN] diff --git a/homeassistant/components/ness_alarm/__init__.py b/homeassistant/components/ness_alarm/__init__.py index 1b72d129f18..a85e1b97921 100644 --- a/homeassistant/components/ness_alarm/__init__.py +++ b/homeassistant/components/ness_alarm/__init__.py @@ -16,10 +16,11 @@ from homeassistant.const import ( CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_STOP, ) -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import config_validation as cv from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.helpers.typing import ConfigType DOMAIN = "ness_alarm" DATA_NESS = "ness_alarm" @@ -84,7 +85,7 @@ SERVICE_SCHEMA_AUX = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Ness Alarm platform.""" conf = config[DOMAIN] diff --git a/homeassistant/components/netgear_lte/__init__.py b/homeassistant/components/netgear_lte/__init__.py index dbcee63bb45..74ddc15e742 100644 --- a/homeassistant/components/netgear_lte/__init__.py +++ b/homeassistant/components/netgear_lte/__init__.py @@ -19,7 +19,7 @@ from homeassistant.const import ( CONF_RECIPIENT, EVENT_HOMEASSISTANT_STOP, ) -from homeassistant.core import ServiceCall, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import config_validation as cv, discovery from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.dispatcher import ( @@ -28,6 +28,7 @@ from homeassistant.helpers.dispatcher import ( ) from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import async_track_time_interval +from homeassistant.helpers.typing import ConfigType from . import sensor_types @@ -171,7 +172,7 @@ class LTEData: return next(iter(self.modem_data.values())) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up Netgear LTE component.""" if DATA_KEY not in hass.data: websession = async_create_clientsession( diff --git a/homeassistant/components/nextcloud/__init__.py b/homeassistant/components/nextcloud/__init__.py index 6af67505e14..48f0c330632 100644 --- a/homeassistant/components/nextcloud/__init__.py +++ b/homeassistant/components/nextcloud/__init__.py @@ -12,8 +12,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.event import track_time_interval +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -90,7 +92,7 @@ SENSORS = ( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Nextcloud integration.""" # Fetch Nextcloud Monitor api data conf = config[DOMAIN] diff --git a/homeassistant/components/notify_events/__init__.py b/homeassistant/components/notify_events/__init__.py index 98702f75cba..60d463a8768 100644 --- a/homeassistant/components/notify_events/__init__.py +++ b/homeassistant/components/notify_events/__init__.py @@ -2,8 +2,10 @@ import voluptuous as vol from homeassistant.const import CONF_TOKEN +from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from .const import DOMAIN @@ -12,7 +14,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the notify_events component.""" hass.data[DOMAIN] = config[DOMAIN] diff --git a/homeassistant/components/nsw_fuel_station/__init__.py b/homeassistant/components/nsw_fuel_station/__init__.py index f64365461f4..6d45104e5d3 100644 --- a/homeassistant/components/nsw_fuel_station/__init__.py +++ b/homeassistant/components/nsw_fuel_station/__init__.py @@ -7,6 +7,8 @@ import logging from nsw_fuel import FuelCheckClient, FuelCheckError, Station +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .const import DATA_NSW_FUEL_STATION @@ -17,7 +19,7 @@ DOMAIN = "nsw_fuel_station" SCAN_INTERVAL = datetime.timedelta(hours=1) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the NSW Fuel Station platform.""" client = FuelCheckClient() diff --git a/homeassistant/components/nuki/__init__.py b/homeassistant/components/nuki/__init__.py index 8bf77e7abd4..6976c2dc682 100644 --- a/homeassistant/components/nuki/__init__.py +++ b/homeassistant/components/nuki/__init__.py @@ -1,5 +1,4 @@ """The nuki component.""" - from datetime import timedelta import logging @@ -9,7 +8,9 @@ from pynuki.bridge import InvalidCredentialsException from requests.exceptions import RequestException from homeassistant import exceptions +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TOKEN, Platform +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -49,7 +50,7 @@ def _update_devices(devices): break -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up the Nuki entry.""" hass.data.setdefault(DOMAIN, {}) @@ -115,7 +116,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 the Nuki entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: diff --git a/homeassistant/components/numato/__init__.py b/homeassistant/components/numato/__init__.py index 1730ff82956..abc43c75895 100644 --- a/homeassistant/components/numato/__init__.py +++ b/homeassistant/components/numato/__init__.py @@ -14,8 +14,10 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP, PERCENTAGE, ) +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -117,7 +119,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize the numato integration. Discovers available Numato devices and loads the binary_sensor, sensor and diff --git a/homeassistant/components/octoprint/__init__.py b/homeassistant/components/octoprint/__init__.py index 102da9240a9..bf0322b6c6d 100644 --- a/homeassistant/components/octoprint/__init__.py +++ b/homeassistant/components/octoprint/__init__.py @@ -24,6 +24,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import DeviceInfo +from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.util import slugify as util_slugify import homeassistant.util.dt as dt_util @@ -122,7 +123,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass: HomeAssistant, config: dict): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the OctoPrint component.""" if DOMAIN not in config: return True @@ -147,7 +148,7 @@ async def async_setup(hass: HomeAssistant, config: dict): return True -async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up OctoPrint from a config entry.""" if DOMAIN not in hass.data: @@ -175,7 +176,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): return True -async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): +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/ombi/__init__.py b/homeassistant/components/ombi/__init__.py index 4f6ee880bc3..48d0f8f840a 100644 --- a/homeassistant/components/ombi/__init__.py +++ b/homeassistant/components/ombi/__init__.py @@ -13,8 +13,9 @@ from homeassistant.const import ( CONF_SSL, CONF_USERNAME, ) -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 .const import ( ATTR_SEASON, @@ -74,7 +75,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Ombi component platform.""" ombi = pyombi.Ombi( diff --git a/homeassistant/components/onboarding/__init__.py b/homeassistant/components/onboarding/__init__.py index 6ffee319d33..8dd59326f6f 100644 --- a/homeassistant/components/onboarding/__init__.py +++ b/homeassistant/components/onboarding/__init__.py @@ -1,6 +1,7 @@ """Support to help onboard new users.""" -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.storage import Store +from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass from . import views @@ -47,7 +48,7 @@ def async_is_user_onboarded(hass): return async_is_onboarded(hass) or STEP_USER in hass.data[DOMAIN]["done"] -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the onboarding component.""" store = OnboadingStorage(hass, STORAGE_VERSION, STORAGE_KEY, private=True) if (data := await store.async_load()) is None: diff --git a/homeassistant/components/opentherm_gw/__init__.py b/homeassistant/components/opentherm_gw/__init__.py index dbb7941154c..ba934fefa12 100644 --- a/homeassistant/components/opentherm_gw/__init__.py +++ b/homeassistant/components/opentherm_gw/__init__.py @@ -6,7 +6,7 @@ import pyotgw import pyotgw.vars as gw_vars import voluptuous as vol -from homeassistant.config_entries import SOURCE_IMPORT +from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import ( ATTR_DATE, ATTR_ID, @@ -22,12 +22,13 @@ from homeassistant.const import ( PRECISION_WHOLE, Platform, ) -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall import homeassistant.helpers.config_validation as cv from homeassistant.helpers.device_registry import ( async_get_registry as async_get_dev_reg, ) from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.helpers.typing import ConfigType from .const import ( ATTR_CH_OVRD, @@ -88,7 +89,7 @@ async def options_updated(hass, entry): async_dispatcher_send(hass, gateway.options_update_signal, entry) -async def async_setup_entry(hass, config_entry): +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up the OpenTherm Gateway component.""" if DATA_OPENTHERM_GW not in hass.data: hass.data[DATA_OPENTHERM_GW] = {DATA_GATEWAYS: {}} @@ -118,7 +119,7 @@ async def async_setup_entry(hass, config_entry): return True -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the OpenTherm Gateway component.""" if not hass.config_entries.async_entries(DOMAIN) and DOMAIN in config: conf = config[DOMAIN] @@ -396,7 +397,7 @@ def register_services(hass): ) -async def async_unload_entry(hass, entry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Cleanup and disconnect from gateway.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) gateway = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][entry.data[CONF_ID]] diff --git a/homeassistant/components/opnsense/__init__.py b/homeassistant/components/opnsense/__init__.py index 900eb327b36..a5c1650f5a1 100644 --- a/homeassistant/components/opnsense/__init__.py +++ b/homeassistant/components/opnsense/__init__.py @@ -6,8 +6,10 @@ from pyopnsense.exceptions import APIException import voluptuous as vol from homeassistant.const import CONF_API_KEY, CONF_URL, CONF_VERIFY_SSL +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -36,7 +38,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the opnsense component.""" conf = config[DOMAIN] diff --git a/homeassistant/components/orangepi_gpio/__init__.py b/homeassistant/components/orangepi_gpio/__init__.py index f8d5ff1be0b..a49833ef182 100644 --- a/homeassistant/components/orangepi_gpio/__init__.py +++ b/homeassistant/components/orangepi_gpio/__init__.py @@ -1,10 +1,11 @@ """Support for controlling GPIO pins of a Orange Pi.""" - import logging from OPi import GPIO from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from .const import PIN_MODES @@ -13,7 +14,7 @@ _LOGGER = logging.getLogger(__name__) DOMAIN = "orangepi_gpio" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Orange Pi GPIO component.""" def cleanup_gpio(event): diff --git a/homeassistant/components/ovo_energy/__init__.py b/homeassistant/components/ovo_energy/__init__.py index fceff685d6f..9d2623af0f9 100644 --- a/homeassistant/components/ovo_energy/__init__.py +++ b/homeassistant/components/ovo_energy/__init__.py @@ -15,7 +15,6 @@ from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers.device_registry import DeviceEntryType from homeassistant.helpers.entity import DeviceInfo -from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -83,7 +82,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return True -async def async_unload_entry(hass: HomeAssistant, entry: ConfigType) -> bool: +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload OVO Energy config entry.""" # Unload sensors unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/owntracks/__init__.py b/homeassistant/components/owntracks/__init__.py index 3cae9505ee8..cbe6ab342f7 100644 --- a/homeassistant/components/owntracks/__init__.py +++ b/homeassistant/components/owntracks/__init__.py @@ -9,6 +9,7 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components import mqtt +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( ATTR_GPS_ACCURACY, ATTR_LATITUDE, @@ -16,8 +17,9 @@ from homeassistant.const import ( CONF_WEBHOOK_ID, Platform, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType from homeassistant.setup import async_when_setup from .config_flow import CONF_SECRET @@ -58,7 +60,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Initialize OwnTracks component.""" hass.data[DOMAIN] = {"config": config[DOMAIN], "devices": {}, "unsub": None} if not hass.config_entries.async_entries(DOMAIN): @@ -71,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 OwnTracks entry.""" config = hass.data[DOMAIN]["config"] max_gps_accuracy = config.get(CONF_MAX_GPS_ACCURACY) @@ -112,7 +114,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 an OwnTracks config entry.""" hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID]) unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) @@ -121,7 +123,7 @@ async def async_unload_entry(hass, entry): return unload_ok -async def async_remove_entry(hass, entry): +async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: """Remove an OwnTracks config entry.""" if not entry.data.get("cloudhook"): return