From 168b3c100c00a8127e86965fd864042f3e9f43ba Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 21 Apr 2021 12:18:42 +0200 Subject: [PATCH] Remove HomeAssistantType alias - Part 4 (#49515) --- homeassistant/components/elgato/light.py | 4 ++-- homeassistant/components/esphome/__init__.py | 19 +++++++++---------- homeassistant/components/esphome/camera.py | 4 ++-- homeassistant/components/esphome/cover.py | 4 ++-- .../components/esphome/entry_data.py | 15 +++++++-------- homeassistant/components/esphome/fan.py | 4 ++-- homeassistant/components/esphome/light.py | 4 ++-- homeassistant/components/esphome/sensor.py | 4 ++-- homeassistant/components/esphome/switch.py | 4 ++-- homeassistant/components/evohome/__init__.py | 8 ++++---- homeassistant/components/evohome/climate.py | 5 +++-- .../components/evohome/water_heater.py | 5 +++-- homeassistant/components/ffmpeg/__init__.py | 5 ++--- .../fireservicerota/binary_sensor.py | 4 ++-- .../components/fireservicerota/sensor.py | 5 ++--- .../components/fireservicerota/switch.py | 5 ++--- homeassistant/components/flo/device.py | 6 +++--- homeassistant/components/freebox/__init__.py | 6 +++--- .../components/freebox/device_tracker.py | 5 ++--- homeassistant/components/freebox/router.py | 6 +++--- homeassistant/components/freebox/sensor.py | 5 ++--- homeassistant/components/freebox/switch.py | 4 ++-- 22 files changed, 63 insertions(+), 68 deletions(-) diff --git a/homeassistant/components/elgato/light.py b/homeassistant/components/elgato/light.py index ae3d8274281..e52e98500d2 100644 --- a/homeassistant/components/elgato/light.py +++ b/homeassistant/components/elgato/light.py @@ -16,8 +16,8 @@ from homeassistant.components.light import ( ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_NAME, ATTR_TEMPERATURE +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import HomeAssistantType from .const import ( ATTR_IDENTIFIERS, @@ -36,7 +36,7 @@ SCAN_INTERVAL = timedelta(seconds=10) async def async_setup_entry( - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable[[list[Entity], bool], None], ) -> None: diff --git a/homeassistant/components/esphome/__init__.py b/homeassistant/components/esphome/__init__.py index 4cd9744a2f8..8edb6d79bcd 100644 --- a/homeassistant/components/esphome/__init__.py +++ b/homeassistant/components/esphome/__init__.py @@ -30,7 +30,7 @@ from homeassistant.const import ( CONF_PORT, EVENT_HOMEASSISTANT_STOP, ) -from homeassistant.core import Event, State, callback +from homeassistant.core import Event, HomeAssistant, State, callback from homeassistant.exceptions import TemplateError from homeassistant.helpers import template import homeassistant.helpers.config_validation as cv @@ -42,7 +42,6 @@ from homeassistant.helpers.json import JSONEncoder from homeassistant.helpers.service import async_set_service_schema from homeassistant.helpers.storage import Store from homeassistant.helpers.template import Template -from homeassistant.helpers.typing import HomeAssistantType # Import config flow so that it's added to the registry from .entry_data import RuntimeEntryData @@ -56,7 +55,7 @@ STORAGE_VERSION = 1 CONFIG_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA) -async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up the esphome component.""" hass.data.setdefault(DOMAIN, {}) @@ -222,7 +221,7 @@ class ReconnectLogic(RecordUpdateListener): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, cli: APIClient, entry: ConfigEntry, host: str, @@ -452,7 +451,7 @@ class ReconnectLogic(RecordUpdateListener): async def _async_setup_device_registry( - hass: HomeAssistantType, entry: ConfigEntry, device_info: DeviceInfo + hass: HomeAssistant, entry: ConfigEntry, device_info: DeviceInfo ): """Set up device registry feature for a particular config entry.""" sw_version = device_info.esphome_version @@ -471,7 +470,7 @@ async def _async_setup_device_registry( async def _register_service( - hass: HomeAssistantType, entry_data: RuntimeEntryData, service: UserService + hass: HomeAssistant, entry_data: RuntimeEntryData, service: UserService ): service_name = f"{entry_data.device_info.name.replace('-', '_')}_{service.name}" schema = {} @@ -549,7 +548,7 @@ async def _register_service( async def _setup_services( - hass: HomeAssistantType, entry_data: RuntimeEntryData, services: list[UserService] + hass: HomeAssistant, entry_data: RuntimeEntryData, services: list[UserService] ): old_services = entry_data.services.copy() to_unregister = [] @@ -580,7 +579,7 @@ async def _setup_services( async def _cleanup_instance( - hass: HomeAssistantType, entry: ConfigEntry + hass: HomeAssistant, entry: ConfigEntry ) -> RuntimeEntryData: """Cleanup the esphome client if it exists.""" data: RuntimeEntryData = hass.data[DOMAIN].pop(entry.entry_id) @@ -592,7 +591,7 @@ async def _cleanup_instance( return data -async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload an esphome config entry.""" entry_data = await _cleanup_instance(hass, entry) tasks = [] @@ -604,7 +603,7 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> boo async def platform_async_setup_entry( - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, async_add_entities, *, diff --git a/homeassistant/components/esphome/camera.py b/homeassistant/components/esphome/camera.py index c868d7b320a..105d77637a7 100644 --- a/homeassistant/components/esphome/camera.py +++ b/homeassistant/components/esphome/camera.py @@ -8,14 +8,14 @@ from aioesphomeapi import CameraInfo, CameraState from homeassistant.components import camera from homeassistant.components.camera import Camera from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.typing import HomeAssistantType from . import EsphomeBaseEntity, platform_async_setup_entry async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up esphome cameras based on a config entry.""" await platform_async_setup_entry( diff --git a/homeassistant/components/esphome/cover.py b/homeassistant/components/esphome/cover.py index 294689d075a..3f4bd29198c 100644 --- a/homeassistant/components/esphome/cover.py +++ b/homeassistant/components/esphome/cover.py @@ -16,13 +16,13 @@ from homeassistant.components.cover import ( CoverEntity, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from . import EsphomeEntity, esphome_state_property, platform_async_setup_entry async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up ESPHome covers based on a config entry.""" await platform_async_setup_entry( diff --git a/homeassistant/components/esphome/entry_data.py b/homeassistant/components/esphome/entry_data.py index 34ed6ffee46..fdaa50bb09c 100644 --- a/homeassistant/components/esphome/entry_data.py +++ b/homeassistant/components/esphome/entry_data.py @@ -23,10 +23,9 @@ from aioesphomeapi import ( import attr from homeassistant.config_entries import ConfigEntry -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.storage import Store -from homeassistant.helpers.typing import HomeAssistantType if TYPE_CHECKING: from . import APIClient @@ -73,7 +72,7 @@ class RuntimeEntryData: @callback def async_update_entity( - self, hass: HomeAssistantType, component_key: str, key: int + self, hass: HomeAssistant, component_key: str, key: int ) -> None: """Schedule the update of an entity.""" signal = f"esphome_{self.entry_id}_update_{component_key}_{key}" @@ -81,14 +80,14 @@ class RuntimeEntryData: @callback def async_remove_entity( - self, hass: HomeAssistantType, component_key: str, key: int + self, hass: HomeAssistant, component_key: str, key: int ) -> None: """Schedule the removal of an entity.""" signal = f"esphome_{self.entry_id}_remove_{component_key}_{key}" async_dispatcher_send(hass, signal) async def _ensure_platforms_loaded( - self, hass: HomeAssistantType, entry: ConfigEntry, platforms: set[str] + self, hass: HomeAssistant, entry: ConfigEntry, platforms: set[str] ): async with self.platform_load_lock: needed = platforms - self.loaded_platforms @@ -102,7 +101,7 @@ class RuntimeEntryData: self.loaded_platforms |= needed async def async_update_static_infos( - self, hass: HomeAssistantType, entry: ConfigEntry, infos: list[EntityInfo] + self, hass: HomeAssistant, entry: ConfigEntry, infos: list[EntityInfo] ) -> None: """Distribute an update of static infos to all platforms.""" # First, load all platforms @@ -119,13 +118,13 @@ class RuntimeEntryData: async_dispatcher_send(hass, signal, infos) @callback - def async_update_state(self, hass: HomeAssistantType, state: EntityState) -> None: + def async_update_state(self, hass: HomeAssistant, state: EntityState) -> None: """Distribute an update of state information to all platforms.""" signal = f"esphome_{self.entry_id}_on_state" async_dispatcher_send(hass, signal, state) @callback - def async_update_device_state(self, hass: HomeAssistantType) -> None: + def async_update_device_state(self, hass: HomeAssistant) -> None: """Distribute an update of a core device state like availability.""" signal = f"esphome_{self.entry_id}_on_device_update" async_dispatcher_send(hass, signal) diff --git a/homeassistant/components/esphome/fan.py b/homeassistant/components/esphome/fan.py index 5d7cf24f2c5..5272cdef5f1 100644 --- a/homeassistant/components/esphome/fan.py +++ b/homeassistant/components/esphome/fan.py @@ -14,7 +14,7 @@ from homeassistant.components.fan import ( FanEntity, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.util.percentage import ( ordered_list_item_to_percentage, percentage_to_ordered_list_item, @@ -33,7 +33,7 @@ ORDERED_NAMED_FAN_SPEEDS = [FanSpeed.LOW, FanSpeed.MEDIUM, FanSpeed.HIGH] async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up ESPHome fans based on a config entry.""" await platform_async_setup_entry( diff --git a/homeassistant/components/esphome/light.py b/homeassistant/components/esphome/light.py index 29fd969d479..d1f567c3c8e 100644 --- a/homeassistant/components/esphome/light.py +++ b/homeassistant/components/esphome/light.py @@ -23,7 +23,7 @@ from homeassistant.components.light import ( LightEntity, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant import homeassistant.util.color as color_util from . import EsphomeEntity, esphome_state_property, platform_async_setup_entry @@ -32,7 +32,7 @@ FLASH_LENGTHS = {FLASH_SHORT: 2, FLASH_LONG: 10} async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up ESPHome lights based on a config entry.""" await platform_async_setup_entry( diff --git a/homeassistant/components/esphome/sensor.py b/homeassistant/components/esphome/sensor.py index d751109c159..045f74d3e4a 100644 --- a/homeassistant/components/esphome/sensor.py +++ b/homeassistant/components/esphome/sensor.py @@ -8,14 +8,14 @@ import voluptuous as vol from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.typing import HomeAssistantType from . import EsphomeEntity, esphome_state_property, platform_async_setup_entry async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up esphome sensors based on a config entry.""" await platform_async_setup_entry( diff --git a/homeassistant/components/esphome/switch.py b/homeassistant/components/esphome/switch.py index 992f014e829..341068b05ad 100644 --- a/homeassistant/components/esphome/switch.py +++ b/homeassistant/components/esphome/switch.py @@ -5,13 +5,13 @@ from aioesphomeapi import SwitchInfo, SwitchState from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from . import EsphomeEntity, esphome_state_property, platform_async_setup_entry async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up ESPHome switches based on a config entry.""" await platform_async_setup_entry( diff --git a/homeassistant/components/evohome/__init__.py b/homeassistant/components/evohome/__init__.py index 8c83308a8b7..cadeefa3c3a 100644 --- a/homeassistant/components/evohome/__init__.py +++ b/homeassistant/components/evohome/__init__.py @@ -23,7 +23,7 @@ from homeassistant.const import ( HTTP_TOO_MANY_REQUESTS, TEMP_CELSIUS, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_load_platform @@ -33,7 +33,7 @@ from homeassistant.helpers.dispatcher import ( ) from homeassistant.helpers.entity import Entity from homeassistant.helpers.service import verify_domain_control -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util from .const import DOMAIN, GWS, STORAGE_KEY, STORAGE_VER, TCS, UTC_OFFSET @@ -175,7 +175,7 @@ def _handle_exception(err) -> bool: raise # we don't expect/handle any other Exceptions -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Create a (EMEA/EU-based) Honeywell TCC system.""" async def load_auth_tokens(store) -> tuple[dict, dict | None]: @@ -264,7 +264,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: @callback -def setup_service_functions(hass: HomeAssistantType, broker): +def setup_service_functions(hass: HomeAssistant, broker): """Set up the service handlers for the system/zone operating modes. Not all Honeywell TCC-compatible systems support all operating modes. In addition, diff --git a/homeassistant/components/evohome/climate.py b/homeassistant/components/evohome/climate.py index f291fcd9cb3..8021ad6ba24 100644 --- a/homeassistant/components/evohome/climate.py +++ b/homeassistant/components/evohome/climate.py @@ -17,7 +17,8 @@ from homeassistant.components.climate.const import ( SUPPORT_TARGET_TEMPERATURE, ) from homeassistant.const import PRECISION_TENTHS -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util from . import ( @@ -75,7 +76,7 @@ STATE_ATTRS_ZONES = ["zoneId", "activeFaults", "setpointStatus", "temperatureSta async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Create the evohome Controller, and its Zones, if any.""" if discovery_info is None: diff --git a/homeassistant/components/evohome/water_heater.py b/homeassistant/components/evohome/water_heater.py index 4e05c553461..692c4dbbc49 100644 --- a/homeassistant/components/evohome/water_heater.py +++ b/homeassistant/components/evohome/water_heater.py @@ -9,7 +9,8 @@ from homeassistant.components.water_heater import ( WaterHeaterEntity, ) from homeassistant.const import PRECISION_TENTHS, PRECISION_WHOLE, STATE_OFF, STATE_ON -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util from . import EvoChild @@ -26,7 +27,7 @@ STATE_ATTRS_DHW = ["dhwId", "activeFaults", "stateStatus", "temperatureStatus"] async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Create a DHW controller.""" if discovery_info is None: diff --git a/homeassistant/components/ffmpeg/__init__.py b/homeassistant/components/ffmpeg/__init__.py index 4bf8de91edc..55e34a547e3 100644 --- a/homeassistant/components/ffmpeg/__init__.py +++ b/homeassistant/components/ffmpeg/__init__.py @@ -13,14 +13,13 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, ) -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 HomeAssistantType DOMAIN = "ffmpeg" @@ -91,7 +90,7 @@ async def async_setup(hass, config): async def async_get_image( - hass: HomeAssistantType, + hass: HomeAssistant, input_source: str, output_format: str = IMAGE_JPEG, extra_cmd: str | None = None, diff --git a/homeassistant/components/fireservicerota/binary_sensor.py b/homeassistant/components/fireservicerota/binary_sensor.py index 29fc97ae503..ef7ef9daa51 100644 --- a/homeassistant/components/fireservicerota/binary_sensor.py +++ b/homeassistant/components/fireservicerota/binary_sensor.py @@ -1,7 +1,7 @@ """Binary Sensor platform for FireServiceRota integration.""" from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -11,7 +11,7 @@ from .const import DATA_CLIENT, DATA_COORDINATOR, DOMAIN as FIRESERVICEROTA_DOMA async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up FireServiceRota binary sensor based on a config entry.""" diff --git a/homeassistant/components/fireservicerota/sensor.py b/homeassistant/components/fireservicerota/sensor.py index 04d8c97a4a5..58b3239331c 100644 --- a/homeassistant/components/fireservicerota/sensor.py +++ b/homeassistant/components/fireservicerota/sensor.py @@ -3,10 +3,9 @@ import logging from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import HomeAssistantType from .const import DATA_CLIENT, DOMAIN as FIRESERVICEROTA_DOMAIN @@ -14,7 +13,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up FireServiceRota sensor based on a config entry.""" client = hass.data[FIRESERVICEROTA_DOMAIN][entry.entry_id][DATA_CLIENT] diff --git a/homeassistant/components/fireservicerota/switch.py b/homeassistant/components/fireservicerota/switch.py index e2385f02e5c..f54e3bc1fa2 100644 --- a/homeassistant/components/fireservicerota/switch.py +++ b/homeassistant/components/fireservicerota/switch.py @@ -3,9 +3,8 @@ import logging from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.typing import HomeAssistantType from .const import DATA_CLIENT, DATA_COORDINATOR, DOMAIN as FIRESERVICEROTA_DOMAIN @@ -13,7 +12,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up FireServiceRota switch based on a config entry.""" client = hass.data[FIRESERVICEROTA_DOMAIN][entry.entry_id][DATA_CLIENT] diff --git a/homeassistant/components/flo/device.py b/homeassistant/components/flo/device.py index 50e0ccda87f..e955c784ae4 100644 --- a/homeassistant/components/flo/device.py +++ b/homeassistant/components/flo/device.py @@ -9,7 +9,7 @@ from aioflo.api import API from aioflo.errors import RequestError from async_timeout import timeout -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed import homeassistant.util.dt as dt_util @@ -20,10 +20,10 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator): """Flo device object.""" def __init__( - self, hass: HomeAssistantType, api_client: API, location_id: str, device_id: str + self, hass: HomeAssistant, api_client: API, location_id: str, device_id: str ): """Initialize the device.""" - self.hass: HomeAssistantType = hass + self.hass: HomeAssistant = hass self.api_client: API = api_client self._flo_location_id: str = location_id self._flo_device_id: str = device_id diff --git a/homeassistant/components/freebox/__init__.py b/homeassistant/components/freebox/__init__.py index a54f34b4d12..976041721c3 100644 --- a/homeassistant/components/freebox/__init__.py +++ b/homeassistant/components/freebox/__init__.py @@ -6,8 +6,8 @@ import voluptuous as vol from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.typing import HomeAssistantType from .const import DOMAIN, PLATFORMS, SERVICE_REBOOT from .router import FreeboxRouter @@ -37,7 +37,7 @@ async def async_setup(hass, config): return True -async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Freebox entry.""" router = FreeboxRouter(hass, entry) await router.setup() @@ -68,7 +68,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): return True -async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry): +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( diff --git a/homeassistant/components/freebox/device_tracker.py b/homeassistant/components/freebox/device_tracker.py index 6510a29bbfc..7485c9da856 100644 --- a/homeassistant/components/freebox/device_tracker.py +++ b/homeassistant/components/freebox/device_tracker.py @@ -6,17 +6,16 @@ from datetime import datetime from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER from homeassistant.components.device_tracker.config_entry import ScannerEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.typing import HomeAssistantType from .const import DEFAULT_DEVICE_NAME, DEVICE_ICONS, DOMAIN from .router import FreeboxRouter async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up device tracker for Freebox component.""" router = hass.data[DOMAIN][entry.unique_id] diff --git a/homeassistant/components/freebox/router.py b/homeassistant/components/freebox/router.py index fbeca869d1d..3f5a4e53528 100644 --- a/homeassistant/components/freebox/router.py +++ b/homeassistant/components/freebox/router.py @@ -13,11 +13,11 @@ from freebox_api.exceptions import HttpRequestError from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_PORT +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.event import async_track_time_interval -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util import slugify from .const import ( @@ -34,7 +34,7 @@ _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(seconds=30) -async def get_api(hass: HomeAssistantType, host: str) -> Freepybox: +async def get_api(hass: HomeAssistant, host: str) -> Freepybox: """Get the Freebox API.""" freebox_path = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY).path @@ -49,7 +49,7 @@ async def get_api(hass: HomeAssistantType, host: str) -> Freepybox: class FreeboxRouter: """Representation of a Freebox router.""" - def __init__(self, hass: HomeAssistantType, entry: ConfigEntry) -> None: + def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize a Freebox router.""" self.hass = hass self._entry = entry diff --git a/homeassistant/components/freebox/sensor.py b/homeassistant/components/freebox/sensor.py index fd0685f7667..c121974f1fa 100644 --- a/homeassistant/components/freebox/sensor.py +++ b/homeassistant/components/freebox/sensor.py @@ -6,9 +6,8 @@ import logging from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import DATA_RATE_KILOBYTES_PER_SECOND -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.typing import HomeAssistantType import homeassistant.util.dt as dt_util from .const import ( @@ -28,7 +27,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up the sensors.""" router = hass.data[DOMAIN][entry.unique_id] diff --git a/homeassistant/components/freebox/switch.py b/homeassistant/components/freebox/switch.py index a15a86f46d8..f309524ceb4 100644 --- a/homeassistant/components/freebox/switch.py +++ b/homeassistant/components/freebox/switch.py @@ -7,7 +7,7 @@ from freebox_api.exceptions import InsufficientPermissionsError from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from .const import DOMAIN from .router import FreeboxRouter @@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up the switch.""" router = hass.data[DOMAIN][entry.unique_id]