diff --git a/homeassistant/components/rachio/__init__.py b/homeassistant/components/rachio/__init__.py index 431e3bffb64..028f02ad292 100644 --- a/homeassistant/components/rachio/__init__.py +++ b/homeassistant/components/rachio/__init__.py @@ -33,7 +33,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return unload_ok -async def async_remove_entry(hass, entry): +async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: """Remove a rachio config entry.""" if CONF_CLOUDHOOK_URL in entry.data: await hass.components.cloud.async_delete_cloudhook(entry.data[CONF_WEBHOOK_ID]) diff --git a/homeassistant/components/rainbird/__init__.py b/homeassistant/components/rainbird/__init__.py index 6aa6e837abe..37eff5e81f0 100644 --- a/homeassistant/components/rainbird/__init__.py +++ b/homeassistant/components/rainbird/__init__.py @@ -15,8 +15,10 @@ from homeassistant.const import ( CONF_PASSWORD, CONF_TRIGGER_TIME, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType CONF_ZONES = "zones" @@ -82,7 +84,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Rain Bird component.""" hass.data[DATA_RAINBIRD] = [] diff --git a/homeassistant/components/raincloud/__init__.py b/homeassistant/components/raincloud/__init__.py index 51e9f5de5ce..75952ebe7eb 100644 --- a/homeassistant/components/raincloud/__init__.py +++ b/homeassistant/components/raincloud/__init__.py @@ -15,10 +15,12 @@ from homeassistant.const import ( TIME_DAYS, TIME_MINUTES, ) +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import track_time_interval +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -92,7 +94,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Melnor RainCloud component.""" conf = config[DOMAIN] username = conf.get(CONF_USERNAME) diff --git a/homeassistant/components/raspihats/__init__.py b/homeassistant/components/raspihats/__init__.py index 478bd9147ef..08626c84439 100644 --- a/homeassistant/components/raspihats/__init__.py +++ b/homeassistant/components/raspihats/__init__.py @@ -4,6 +4,8 @@ import threading import time 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__) @@ -29,7 +31,7 @@ I2C_HAT_NAMES = [ I2C_HATS_MANAGER = "I2CH_MNG" -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the raspihats component.""" hass.data[I2C_HATS_MANAGER] = I2CHatsManager() diff --git a/homeassistant/components/remember_the_milk/__init__.py b/homeassistant/components/remember_the_milk/__init__.py index 43658db907c..8e8127bd29b 100644 --- a/homeassistant/components/remember_the_milk/__init__.py +++ b/homeassistant/components/remember_the_milk/__init__.py @@ -7,9 +7,11 @@ from rtmapi import Rtm, RtmRequestFailedException import voluptuous as vol from homeassistant.const import CONF_API_KEY, CONF_ID, CONF_NAME, CONF_TOKEN, STATE_OK +from homeassistant.core import HomeAssistant 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 # httplib2 is a transitive dependency from RtmAPI. If this dependency is not # set explicitly, the library does not work. @@ -47,7 +49,7 @@ SERVICE_SCHEMA_CREATE_TASK = vol.Schema( SERVICE_SCHEMA_COMPLETE_TASK = vol.Schema({vol.Required(CONF_ID): cv.string}) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Remember the milk component.""" component = EntityComponent(_LOGGER, DOMAIN, hass) diff --git a/homeassistant/components/remote_rpi_gpio/__init__.py b/homeassistant/components/remote_rpi_gpio/__init__.py index b11625eb7b2..c77ae7fde9c 100644 --- a/homeassistant/components/remote_rpi_gpio/__init__.py +++ b/homeassistant/components/remote_rpi_gpio/__init__.py @@ -2,6 +2,9 @@ from gpiozero import LED, DigitalInputDevice from gpiozero.pins.pigpio import PiGPIOFactory +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + CONF_BOUNCETIME = "bouncetime" CONF_INVERT_LOGIC = "invert_logic" CONF_PULL_MODE = "pull_mode" @@ -13,7 +16,7 @@ DEFAULT_PULL_MODE = "UP" DOMAIN = "remote_rpi_gpio" -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Raspberry Pi Remote GPIO component.""" return True diff --git a/homeassistant/components/repetier/__init__.py b/homeassistant/components/repetier/__init__.py index 0c88d49eb22..d927a6d854d 100644 --- a/homeassistant/components/repetier/__init__.py +++ b/homeassistant/components/repetier/__init__.py @@ -19,10 +19,12 @@ from homeassistant.const import ( PERCENTAGE, TEMP_CELSIUS, ) +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.event import track_time_interval +from homeassistant.helpers.typing import ConfigType from homeassistant.util import slugify as util_slugify _LOGGER = logging.getLogger(__name__) @@ -215,7 +217,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Repetier Server component.""" hass.data[REPETIER_API] = {} diff --git a/homeassistant/components/rest_command/__init__.py b/homeassistant/components/rest_command/__init__.py index 43754358a78..f9174743f3c 100644 --- a/homeassistant/components/rest_command/__init__.py +++ b/homeassistant/components/rest_command/__init__.py @@ -17,9 +17,10 @@ from homeassistant.const import ( CONF_USERNAME, CONF_VERIFY_SSL, ) -from homeassistant.core import ServiceCall, callback +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType DOMAIN = "rest_command" @@ -54,7 +55,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the REST command component.""" @callback diff --git a/homeassistant/components/rflink/__init__.py b/homeassistant/components/rflink/__init__.py index 7092cf1c811..563ecedec3d 100644 --- a/homeassistant/components/rflink/__init__.py +++ b/homeassistant/components/rflink/__init__.py @@ -18,7 +18,7 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP, STATE_ON, ) -from homeassistant.core import CoreState, ServiceCall, callback +from homeassistant.core import CoreState, HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( @@ -27,6 +27,7 @@ from homeassistant.helpers.dispatcher import ( ) from homeassistant.helpers.entity import Entity from homeassistant.helpers.restore_state import RestoreEntity +from homeassistant.helpers.typing import ConfigType from .utils import brightness_to_rflink @@ -121,7 +122,7 @@ def identify_event_type(event): return "unknown" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Rflink component.""" # Allow entities to register themselves by device_id to be looked up when # new rflink events arrive to be handled diff --git a/homeassistant/components/ring/__init__.py b/homeassistant/components/ring/__init__.py index 2e84a00e378..242b4cb8ba0 100644 --- a/homeassistant/components/ring/__init__.py +++ b/homeassistant/components/ring/__init__.py @@ -11,9 +11,11 @@ from oauthlib.oauth2 import AccessDeniedError import requests from ring_doorbell import Auth, Ring +from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform, __version__ from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers.event import async_track_time_interval +from homeassistant.helpers.typing import ConfigType from homeassistant.util.async_ import run_callback_threadsafe _LOGGER = logging.getLogger(__name__) @@ -35,7 +37,7 @@ PLATFORMS = [ ] -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Ring component.""" if DOMAIN not in config: return True @@ -51,7 +53,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 a config entry.""" def token_updater(token): @@ -125,7 +127,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 Ring entry.""" if not await hass.config_entries.async_unload_platforms(entry, PLATFORMS): return False diff --git a/homeassistant/components/roomba/__init__.py b/homeassistant/components/roomba/__init__.py index 2911f46d55d..dc16e92b237 100644 --- a/homeassistant/components/roomba/__init__.py +++ b/homeassistant/components/roomba/__init__.py @@ -6,6 +6,7 @@ import async_timeout from roombapy import RoombaConnectionError, RoombaFactory from homeassistant import exceptions +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONF_DELAY, CONF_HOST, @@ -13,6 +14,7 @@ from homeassistant.const import ( CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP, ) +from homeassistant.core import HomeAssistant from .const import ( BLID, @@ -27,7 +29,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -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 roomba platforms with config entry @@ -114,7 +116,7 @@ async def async_update_options(hass, config_entry): await hass.config_entries.async_reload(config_entry.entry_id) -async def async_unload_entry(hass, config_entry): +async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms( config_entry, PLATFORMS diff --git a/homeassistant/components/roon/__init__.py b/homeassistant/components/roon/__init__.py index 94c51abf705..133598070c2 100644 --- a/homeassistant/components/roon/__init__.py +++ b/homeassistant/components/roon/__init__.py @@ -1,12 +1,14 @@ """Roon (www.roonlabs.com) component.""" +from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST +from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr from .const import DOMAIN from .server import RoonServer -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up a roonserver from a config entry.""" hass.data.setdefault(DOMAIN, {}) host = entry.data[CONF_HOST] @@ -26,7 +28,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.""" roonserver = hass.data[DOMAIN].pop(entry.entry_id) return await roonserver.async_reset() diff --git a/homeassistant/components/route53/__init__.py b/homeassistant/components/route53/__init__.py index 095f3cc4539..4f17b507560 100644 --- a/homeassistant/components/route53/__init__.py +++ b/homeassistant/components/route53/__init__.py @@ -10,9 +10,10 @@ import requests import voluptuous as vol from homeassistant.const import CONF_DOMAIN, CONF_TTL, CONF_ZONE -from homeassistant.core import ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import track_time_interval +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -42,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Route53 component.""" domain = config[DOMAIN][CONF_DOMAIN] records = config[DOMAIN][CONF_RECORDS] diff --git a/homeassistant/components/rpi_camera/__init__.py b/homeassistant/components/rpi_camera/__init__.py index a854338ee78..ffa21b55180 100644 --- a/homeassistant/components/rpi_camera/__init__.py +++ b/homeassistant/components/rpi_camera/__init__.py @@ -2,7 +2,9 @@ import voluptuous as vol from homeassistant.const import CONF_FILE_PATH, CONF_NAME +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, discovery +from homeassistant.helpers.typing import ConfigType from .const import ( CONF_HORIZONTAL_FLIP, @@ -63,7 +65,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the rpi_camera integration.""" config_domain = config[DOMAIN] hass.data[DOMAIN] = { diff --git a/homeassistant/components/rpi_gpio/__init__.py b/homeassistant/components/rpi_gpio/__init__.py index b8f8bed05a6..94336980fa6 100644 --- a/homeassistant/components/rpi_gpio/__init__.py +++ b/homeassistant/components/rpi_gpio/__init__.py @@ -6,6 +6,8 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP, Platform, ) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType DOMAIN = "rpi_gpio" PLATFORMS = [ @@ -15,7 +17,7 @@ PLATFORMS = [ ] -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Raspberry PI GPIO component.""" def cleanup_gpio(event): diff --git a/homeassistant/components/rpi_pfio/__init__.py b/homeassistant/components/rpi_pfio/__init__.py index 45b3e98d977..625e506b13d 100644 --- a/homeassistant/components/rpi_pfio/__init__.py +++ b/homeassistant/components/rpi_pfio/__init__.py @@ -2,13 +2,15 @@ import pifacedigitalio as PFIO from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType DOMAIN = "rpi_pfio" DATA_PFIO_LISTENER = "pfio_listener" -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Raspberry PI PFIO component.""" pifacedigital = PFIO.PiFaceDigital() hass.data[DATA_PFIO_LISTENER] = PFIO.InputEventListener(chip=pifacedigital) diff --git a/homeassistant/components/rss_feed_template/__init__.py b/homeassistant/components/rss_feed_template/__init__.py index fb830bccee7..3b88f9c0288 100644 --- a/homeassistant/components/rss_feed_template/__init__.py +++ b/homeassistant/components/rss_feed_template/__init__.py @@ -5,7 +5,9 @@ from aiohttp import web import voluptuous as vol from homeassistant.components.http import HomeAssistantView +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.typing import ConfigType CONTENT_TYPE_XML = "text/xml" DOMAIN = "rss_feed_template" @@ -36,7 +38,7 @@ CONFIG_SCHEMA = vol.Schema( ) -def setup(hass, config): +def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the RSS feed template component.""" for (feeduri, feedconfig) in config[DOMAIN].items(): url = f"/api/rss_template/{feeduri}"