diff --git a/homeassistant/components/satel_integra/__init__.py b/homeassistant/components/satel_integra/__init__.py index 34b5511c394..58a255b0283 100644 --- a/homeassistant/components/satel_integra/__init__.py +++ b/homeassistant/components/satel_integra/__init__.py @@ -6,10 +6,11 @@ from satel_integra.satel_integra import AsyncSatel import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback 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 DEFAULT_ALARM_NAME = "satel_integra" DEFAULT_PORT = 7094 @@ -90,9 +91,9 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Satel Integra component.""" - conf = config.get(DOMAIN) + conf = config[DOMAIN] zones = conf.get(CONF_ZONES) outputs = conf.get(CONF_OUTPUTS) diff --git a/homeassistant/components/scrape/sensor.py b/homeassistant/components/scrape/sensor.py index 330df3dd245..4cb6975f0f0 100644 --- a/homeassistant/components/scrape/sensor.py +++ b/homeassistant/components/scrape/sensor.py @@ -1,4 +1,6 @@ """Support for getting data from websites with scraping.""" +from __future__ import annotations + import logging from bs4 import BeautifulSoup @@ -27,8 +29,11 @@ from homeassistant.const import ( HTTP_BASIC_AUTHENTICATION, HTTP_DIGEST_AUTHENTICATION, ) +from homeassistant.core import HomeAssistant from homeassistant.exceptions import PlatformNotReady import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType _LOGGER = logging.getLogger(__name__) @@ -61,7 +66,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the Web scrape sensor.""" name = config.get(CONF_NAME) resource = config.get(CONF_RESOURCE) @@ -81,6 +91,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= if (value_template := config.get(CONF_VALUE_TEMPLATE)) is not None: value_template.hass = hass + auth: httpx.DigestAuth | tuple[str, str] | None if username and password: if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION: auth = httpx.DigestAuth(username, password) diff --git a/homeassistant/components/shopping_list/__init__.py b/homeassistant/components/shopping_list/__init__.py index 34ad95a250c..10d5ecd5975 100644 --- a/homeassistant/components/shopping_list/__init__.py +++ b/homeassistant/components/shopping_list/__init__.py @@ -8,6 +8,7 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.components import http, websocket_api from homeassistant.components.http.data_validator import RequestDataValidator +from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_NAME from homeassistant.core import HomeAssistant, ServiceCall, callback import homeassistant.helpers.config_validation as cv @@ -77,7 +78,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: return True -async def async_setup_entry(hass, config_entry): +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up shopping list from config flow.""" async def add_item_service(call: ServiceCall) -> None: diff --git a/homeassistant/components/sisyphus/__init__.py b/homeassistant/components/sisyphus/__init__.py index 841fbb68178..03e2432f5a2 100644 --- a/homeassistant/components/sisyphus/__init__.py +++ b/homeassistant/components/sisyphus/__init__.py @@ -6,9 +6,11 @@ from sisyphus_control import Table import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_load_platform +from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) @@ -28,7 +30,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the sisyphus component.""" class SocketIONoiseFilter(logging.Filter): @@ -41,7 +43,7 @@ async def async_setup(hass, config): logging.getLogger("socketIO-client").addFilter(SocketIONoiseFilter()) tables = hass.data.setdefault(DATA_SISYPHUS, {}) - table_configs = config.get(DOMAIN) + table_configs = config[DOMAIN] session = async_get_clientsession(hass) async def add_table(host, name=None): diff --git a/homeassistant/components/skybell/binary_sensor.py b/homeassistant/components/skybell/binary_sensor.py index bede414f8ee..bf8ffcfce9d 100644 --- a/homeassistant/components/skybell/binary_sensor.py +++ b/homeassistant/components/skybell/binary_sensor.py @@ -13,7 +13,10 @@ from homeassistant.components.binary_sensor import ( BinarySensorEntityDescription, ) from homeassistant.const import CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import DEFAULT_ENTITY_NAMESPACE, DOMAIN as SKYBELL_DOMAIN, SkybellDevice @@ -46,9 +49,14 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -def setup_platform(hass, config, add_entities, discovery_info=None): +def setup_platform( + hass: HomeAssistant, + config: ConfigType, + add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the platform for a Skybell device.""" - skybell = hass.data.get(SKYBELL_DOMAIN) + skybell = hass.data[SKYBELL_DOMAIN] binary_sensors = [ SkybellBinarySensor(device, BINARY_SENSOR_TYPES[sensor_type]) diff --git a/homeassistant/components/skybell/camera.py b/homeassistant/components/skybell/camera.py index 20e93fb90f7..96989fad747 100644 --- a/homeassistant/components/skybell/camera.py +++ b/homeassistant/components/skybell/camera.py @@ -9,7 +9,10 @@ import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, Camera from homeassistant.const import CONF_MONITORED_CONDITIONS +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import DOMAIN as SKYBELL_DOMAIN, SkybellDevice @@ -34,13 +37,18 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -def setup_platform(hass, config, add_entities, discovery_info=None): +def setup_platform( + hass: HomeAssistant, + config: ConfigType, + add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the platform for a Skybell device.""" cond = config[CONF_MONITORED_CONDITIONS] names = {} names[IMAGE_ACTIVITY] = config.get(CONF_ACTIVITY_NAME) names[IMAGE_AVATAR] = config.get(CONF_AVATAR_NAME) - skybell = hass.data.get(SKYBELL_DOMAIN) + skybell = hass.data[SKYBELL_DOMAIN] sensors = [] for device in skybell.get_devices(): diff --git a/homeassistant/components/skybell/light.py b/homeassistant/components/skybell/light.py index aecaea01d2a..6285c183384 100644 --- a/homeassistant/components/skybell/light.py +++ b/homeassistant/components/skybell/light.py @@ -1,4 +1,6 @@ """Light/LED support for the Skybell HD Doorbell.""" +from __future__ import annotations + from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_HS_COLOR, @@ -6,14 +8,22 @@ from homeassistant.components.light import ( SUPPORT_COLOR, LightEntity, ) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType import homeassistant.util.color as color_util from . import DOMAIN as SKYBELL_DOMAIN, SkybellDevice -def setup_platform(hass, config, add_entities, discovery_info=None): +def setup_platform( + hass: HomeAssistant, + config: ConfigType, + add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the platform for a Skybell device.""" - skybell = hass.data.get(SKYBELL_DOMAIN) + skybell = hass.data[SKYBELL_DOMAIN] sensors = [] for device in skybell.get_devices(): diff --git a/homeassistant/components/skybell/sensor.py b/homeassistant/components/skybell/sensor.py index 0ac26c1c76b..5922bb05382 100644 --- a/homeassistant/components/skybell/sensor.py +++ b/homeassistant/components/skybell/sensor.py @@ -11,7 +11,10 @@ from homeassistant.components.sensor import ( SensorEntityDescription, ) from homeassistant.const import CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import DEFAULT_ENTITY_NAMESPACE, DOMAIN as SKYBELL_DOMAIN, SkybellDevice @@ -39,9 +42,14 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -def setup_platform(hass, config, add_entities, discovery_info=None): +def setup_platform( + hass: HomeAssistant, + config: ConfigType, + add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the platform for a Skybell device.""" - skybell = hass.data.get(SKYBELL_DOMAIN) + skybell = hass.data[SKYBELL_DOMAIN] sensors = [ SkybellSensor(device, description) diff --git a/homeassistant/components/skybell/switch.py b/homeassistant/components/skybell/switch.py index c842f0e91af..2873ad2c081 100644 --- a/homeassistant/components/skybell/switch.py +++ b/homeassistant/components/skybell/switch.py @@ -9,7 +9,10 @@ from homeassistant.components.switch import ( SwitchEntityDescription, ) from homeassistant.const import CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import DEFAULT_ENTITY_NAMESPACE, DOMAIN as SKYBELL_DOMAIN, SkybellDevice @@ -38,9 +41,14 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -def setup_platform(hass, config, add_entities, discovery_info=None): +def setup_platform( + hass: HomeAssistant, + config: ConfigType, + add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the platform for a Skybell device.""" - skybell = hass.data.get(SKYBELL_DOMAIN) + skybell = hass.data[SKYBELL_DOMAIN] switches = [ SkybellSwitch(device, description)