Add init type hints [s] (#63193)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-02 16:29:52 +01:00 committed by GitHub
parent 33e926371f
commit 00ec874389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 73 additions and 42 deletions

View File

@ -14,6 +14,7 @@ from homeassistant.const import CONF_PLATFORM, SERVICE_TURN_ON
from homeassistant.core import DOMAIN as HA_DOMAIN, HomeAssistant from homeassistant.core import DOMAIN as HA_DOMAIN, HomeAssistant
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType
# mypy: allow-untyped-defs, no-check-untyped-defs # mypy: allow-untyped-defs, no-check-untyped-defs
@ -58,7 +59,7 @@ PLATFORM_SCHEMA = vol.Schema(
) )
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the scenes.""" """Set up the scenes."""
component = hass.data[DOMAIN] = EntityComponent( component = hass.data[DOMAIN] = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass logging.getLogger(__name__), DOMAIN, hass

View File

@ -9,8 +9,9 @@ from scsgate.tasks import GetStatusTask
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_DEVICE, CONF_NAME from homeassistant.const import CONF_DEVICE, CONF_NAME
from homeassistant.core import EVENT_HOMEASSISTANT_STOP from homeassistant.core import EVENT_HOMEASSISTANT_STOP, HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -27,7 +28,7 @@ SCSGATE_SCHEMA = vol.Schema(
) )
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the SCSGate component.""" """Set up the SCSGate component."""
device = config[DOMAIN][CONF_DEVICE] device = config[DOMAIN][CONF_DEVICE]
scsgate = None scsgate = None

View File

@ -1,5 +1,4 @@
"""Shark IQ Integration.""" """Shark IQ Integration."""
import asyncio import asyncio
from contextlib import suppress from contextlib import suppress
@ -13,7 +12,9 @@ from sharkiqpy import (
) )
from homeassistant import exceptions from homeassistant import exceptions
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from .const import _LOGGER, API_TIMEOUT, DOMAIN, PLATFORMS from .const import _LOGGER, API_TIMEOUT, DOMAIN, PLATFORMS
from .update_coordinator import SharkIqUpdateCoordinator from .update_coordinator import SharkIqUpdateCoordinator
@ -39,7 +40,7 @@ async def async_connect_or_timeout(ayla_api: AylaApi) -> bool:
return True return True
async def async_setup_entry(hass, config_entry): async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Initialize the sharkiq platform via config entry.""" """Initialize the sharkiq platform via config entry."""
ayla_api = get_ayla_api( ayla_api = get_ayla_api(
username=config_entry.data[CONF_USERNAME], username=config_entry.data[CONF_USERNAME],
@ -83,7 +84,7 @@ async def async_update_options(hass, config_entry):
await hass.config_entries.async_reload(config_entry.entry_id) 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 a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms( unload_ok = await hass.config_entries.async_unload_platforms(
config_entry, PLATFORMS config_entry, PLATFORMS

View File

@ -8,8 +8,10 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
EVENT_STATE_CHANGED, EVENT_STATE_CHANGED,
) )
from homeassistant.core import HomeAssistant
from homeassistant.helpers import state as state_helper from homeassistant.helpers import state as state_helper
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
DOMAIN = "shiftr" DOMAIN = "shiftr"
@ -28,7 +30,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Initialize the Shiftr.io MQTT consumer.""" """Initialize the Shiftr.io MQTT consumer."""
conf = config[DOMAIN] conf = config[DOMAIN]
username = conf.get(CONF_USERNAME) username = conf.get(CONF_USERNAME)

View File

@ -1,6 +1,8 @@
"""The sky_hub component.""" """The sky_hub component."""
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the sky_hub component.""" """Set up the sky_hub component."""
return True return True

View File

@ -11,8 +11,10 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
__version__, __version__,
) )
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -40,7 +42,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Skybell component.""" """Set up the Skybell component."""
conf = config[DOMAIN] conf = config[DOMAIN]
username = conf.get(CONF_USERNAME) username = conf.get(CONF_USERNAME)

View File

@ -6,9 +6,11 @@ from sleepyq import Sleepyq
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import Throttle from homeassistant.util import Throttle
from .const import DOMAIN from .const import DOMAIN
@ -30,7 +32,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the SleepIQ component. """Set up the SleepIQ component.
Will automatically load sensor components to support Will automatically load sensor components to support

View File

@ -1,5 +1,4 @@
"""Component for the Slide API.""" """Component for the Slide API."""
from datetime import timedelta from datetime import timedelta
import logging import logging
@ -15,9 +14,11 @@ from homeassistant.const import (
STATE_OPEN, STATE_OPEN,
STATE_OPENING, STATE_OPENING,
) )
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.event import async_call_later, async_track_time_interval from homeassistant.helpers.event import async_call_later, async_track_time_interval
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
API, API,
@ -50,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 Slide platform.""" """Set up the Slide platform."""
async def update_slides(now=None): async def update_slides(now=None):

View File

@ -1,5 +1,7 @@
"""SmartTub integration.""" """SmartTub integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from .const import DOMAIN, SMARTTUB_CONTROLLER from .const import DOMAIN, SMARTTUB_CONTROLLER
from .controller import SmartTubController from .controller import SmartTubController
@ -13,7 +15,7 @@ PLATFORMS = [
] ]
async def async_setup_entry(hass, entry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up a smarttub config entry.""" """Set up a smarttub config entry."""
controller = SmartTubController(hass) controller = SmartTubController(hass)
@ -30,7 +32,7 @@ async def async_setup_entry(hass, entry):
return True return True
async def async_unload_entry(hass, entry): async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Remove a smarttub config entry.""" """Remove a smarttub config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok: if unload_ok:

View File

@ -1,5 +1,4 @@
"""Support to control a Salda Smarty XP/XV ventilation unit.""" """Support to control a Salda Smarty XP/XV ventilation unit."""
from datetime import timedelta from datetime import timedelta
import ipaddress import ipaddress
import logging import logging
@ -8,10 +7,12 @@ from pysmarty import Smarty
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.dispatcher import dispatcher_send
from homeassistant.helpers.event import track_time_interval from homeassistant.helpers.event import track_time_interval
from homeassistant.helpers.typing import ConfigType
DOMAIN = "smarty" DOMAIN = "smarty"
DATA_SMARTY = "smarty" DATA_SMARTY = "smarty"
@ -35,7 +36,7 @@ RPM = "rpm"
SIGNAL_UPDATE_SMARTY = "smarty_update" SIGNAL_UPDATE_SMARTY = "smarty_update"
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the smarty environment.""" """Set up the smarty environment."""
conf = config[DOMAIN] conf = config[DOMAIN]

View File

@ -1,11 +1,11 @@
"""The sms component.""" """The sms component."""
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_DEVICE, Platform from homeassistant.const import CONF_DEVICE, Platform
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN, SMS_GATEWAY from .const import DOMAIN, SMS_GATEWAY
from .gateway import create_sms_gateway from .gateway import create_sms_gateway
@ -18,7 +18,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Configure Gammu state machine.""" """Configure Gammu state machine."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
if not (sms_config := config.get(DOMAIN, {})): if not (sms_config := config.get(DOMAIN, {})):

View File

@ -6,8 +6,9 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components import mqtt from homeassistant.components import mqtt
from homeassistant.core import ServiceCall from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers import config_validation as cv, intent from homeassistant.helpers import config_validation as cv, intent
from homeassistant.helpers.typing import ConfigType
DOMAIN = "snips" DOMAIN = "snips"
CONF_INTENTS = "intents" CONF_INTENTS = "intents"
@ -87,7 +88,7 @@ SERVICE_SCHEMA_FEEDBACK = vol.Schema(
) )
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Activate Snips component.""" """Activate Snips component."""
async def async_set_feedback(site_ids, state): async def async_set_feedback(site_ids, state):

View File

@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return True return True
async def async_unload_entry(hass, entry): async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@ -1,5 +1,4 @@
"""Support for Soma Smartshades.""" """Support for Soma Smartshades."""
from api.soma_api import SomaApi from api.soma_api import SomaApi
import voluptuous as vol import voluptuous as vol
@ -9,6 +8,7 @@ from homeassistant.const import CONF_HOST, CONF_PORT, Platform
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import DeviceInfo, Entity from homeassistant.helpers.entity import DeviceInfo, Entity
from homeassistant.helpers.typing import ConfigType
from .const import API, DOMAIN, HOST, PORT from .const import API, DOMAIN, HOST, PORT
@ -29,7 +29,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = [Platform.COVER, Platform.SENSOR] PLATFORMS = [Platform.COVER, Platform.SENSOR]
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Soma component.""" """Set up the Soma component."""
if DOMAIN not in config: if DOMAIN not in config:
return True return True

View File

@ -18,6 +18,7 @@ from homeassistant.helpers import (
config_validation as cv, config_validation as cv,
device_registry as dr, device_registry as dr,
) )
from homeassistant.helpers.typing import ConfigType
from . import api, config_flow from . import api, config_flow
from .const import COORDINATOR, DOMAIN from .const import COORDINATOR, DOMAIN
@ -52,7 +53,7 @@ PLATFORMS = [
] ]
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Somfy component.""" """Set up the Somfy component."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}
domain_config = config.get(DOMAIN, {}) domain_config = config.get(DOMAIN, {})

View File

@ -1,5 +1,4 @@
"""The songpal component.""" """The songpal component."""
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry

View File

@ -6,9 +6,11 @@ from pyspcwebgw.area import Area
from pyspcwebgw.zone import Zone from pyspcwebgw.zone import Zone
import voluptuous as vol import voluptuous as vol
from homeassistant.core import HomeAssistant
from homeassistant.helpers import aiohttp_client, discovery from homeassistant.helpers import aiohttp_client, discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -34,7 +36,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the SPC component.""" """Set up the SPC component."""
async def async_upate_callback(spc_object): async def async_upate_callback(spc_object):

View File

@ -4,10 +4,12 @@ import logging
from spiderpy.spiderapi import SpiderApi, SpiderApiException, UnauthorizedException from spiderpy.spiderapi import SpiderApi, SpiderApiException, UnauthorizedException
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN, PLATFORMS from .const import DEFAULT_SCAN_INTERVAL, DOMAIN, PLATFORMS
@ -32,7 +34,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up a config entry.""" """Set up a config entry."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}
if DOMAIN not in config: if DOMAIN not in config:
@ -50,7 +52,7 @@ async def async_setup(hass, config):
return True return True
async def async_setup_entry(hass, entry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Spider via config entry.""" """Set up Spider via config entry."""
try: try:
api = await hass.async_add_executor_job( api = await hass.async_add_executor_job(
@ -73,7 +75,7 @@ async def async_setup_entry(hass, entry):
return True return True
async def async_unload_entry(hass, entry): async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload Spider entry.""" """Unload Spider entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if not unload_ok: if not unload_ok:

View File

@ -18,11 +18,13 @@ from homeassistant.const import (
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
EVENT_STATE_CHANGED, EVENT_STATE_CHANGED,
) )
from homeassistant.core import HomeAssistant
from homeassistant.helpers import state as state_helper from homeassistant.helpers import state as state_helper
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entityfilter import FILTER_SCHEMA from homeassistant.helpers.entityfilter import FILTER_SCHEMA
from homeassistant.helpers.json import JSONEncoder from homeassistant.helpers.json import JSONEncoder
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -52,7 +54,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Splunk component.""" """Set up the Splunk component."""
conf = config[DOMAIN] conf = config[DOMAIN]
host = conf.get(CONF_HOST) host = conf.get(CONF_HOST)

View File

@ -19,7 +19,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return True return True
async def async_unload_entry(hass, entry): async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
# Stop player discovery task for this config entry. # Stop player discovery task for this config entry.
hass.data[DOMAIN][entry.entry_id][PLAYER_DISCOVERY_UNSUB]() hass.data[DOMAIN][entry.entry_id][PLAYER_DISCOVERY_UNSUB]()

View File

@ -5,8 +5,10 @@ import statsd
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_PREFIX, EVENT_STATE_CHANGED from homeassistant.const import CONF_HOST, CONF_PORT, CONF_PREFIX, EVENT_STATE_CHANGED
from homeassistant.core import HomeAssistant
from homeassistant.helpers import state as state_helper from homeassistant.helpers import state as state_helper
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -39,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the StatsD component.""" """Set up the StatsD component."""
conf = config[DOMAIN] conf = config[DOMAIN]

View File

@ -7,8 +7,10 @@ import voluptuous as vol
from homeassistant.components.modbus.const import CONF_HUB, DEFAULT_HUB, MODBUS_DOMAIN from homeassistant.components.modbus.const import CONF_HUB, DEFAULT_HUB, MODBUS_DOMAIN
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import Throttle from homeassistant.util import Throttle
DOMAIN = "stiebel_eltron" DOMAIN = "stiebel_eltron"
@ -30,7 +32,7 @@ _LOGGER = logging.getLogger(__name__)
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30) MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the STIEBEL ELTRON unit. """Set up the STIEBEL ELTRON unit.
Will automatically load climate platform. Will automatically load climate platform.

View File

@ -5,9 +5,10 @@ from streamlabswater import streamlabswater
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_API_KEY, Platform from homeassistant.const import CONF_API_KEY, Platform
from homeassistant.core import ServiceCall from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
DOMAIN = "streamlabswater" DOMAIN = "streamlabswater"
@ -39,7 +40,7 @@ SET_AWAY_MODE_SCHEMA = vol.Schema(
) )
def setup(hass, config): def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the streamlabs water integration.""" """Set up the streamlabs water integration."""
conf = config[DOMAIN] conf = config[DOMAIN]

View File

@ -36,7 +36,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, entry): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Subaru from a config entry.""" """Set up Subaru from a config entry."""
config = entry.data config = entry.data
websession = aiohttp_client.async_get_clientsession(hass) websession = aiohttp_client.async_get_clientsession(hass)

View File

@ -8,13 +8,14 @@ from homeassistant.const import (
SUN_EVENT_SUNRISE, SUN_EVENT_SUNRISE,
SUN_EVENT_SUNSET, SUN_EVENT_SUNSET,
) )
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import event from homeassistant.helpers import event
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.sun import ( from homeassistant.helpers.sun import (
get_astral_location, get_astral_location,
get_location_astral_event_next, get_location_astral_event_next,
) )
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import dt as dt_util from homeassistant.util import dt as dt_util
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs # mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
@ -72,7 +73,7 @@ _PHASE_UPDATES = {
} }
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Track the state of the sun.""" """Track the state of the sun."""
if config.get(CONF_ELEVATION) is not None: if config.get(CONF_ELEVATION) is not None:
_LOGGER.warning( _LOGGER.warning(

View File

@ -9,9 +9,11 @@ from asyncpysupla import SuplaAPI
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
@ -51,7 +53,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass, base_config): async def async_setup(hass: HomeAssistant, base_config: ConfigType) -> bool:
"""Set up the Supla component.""" """Set up the Supla component."""
server_confs = base_config[DOMAIN][CONF_SERVERS] server_confs = base_config[DOMAIN][CONF_SERVERS]

View File

@ -10,8 +10,9 @@ import voluptuous as vol
from homeassistant import __path__ as HOMEASSISTANT_PATH from homeassistant import __path__ as HOMEASSISTANT_PATH
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE, EVENT_HOMEASSISTANT_STOP from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import ServiceCall, callback from homeassistant.core import HomeAssistant, ServiceCall, callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
CONF_MAX_ENTRIES = "max_entries" CONF_MAX_ENTRIES = "max_entries"
CONF_FIRE_EVENT = "fire_event" CONF_FIRE_EVENT = "fire_event"
@ -194,7 +195,7 @@ class LogErrorHandler(logging.Handler):
self.hass.bus.fire(EVENT_SYSTEM_LOG, entry.to_dict()) self.hass.bus.fire(EVENT_SYSTEM_LOG, entry.to_dict())
async def async_setup(hass, config): async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the logger component.""" """Set up the logger component."""
if (conf := config.get(DOMAIN)) is None: if (conf := config.get(DOMAIN)) is None:
conf = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN] conf = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN]