diff --git a/custom_components/hon/__init__.py b/custom_components/hon/__init__.py index 81b81bb..e29abd7 100644 --- a/custom_components/hon/__init__.py +++ b/custom_components/hon/__init__.py @@ -5,8 +5,8 @@ from typing import Any import voluptuous as vol # type: ignore[import-untyped] from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_EMAIL, CONF_PASSWORD -from homeassistant.core import HomeAssistant as HomeAssistantType from homeassistant.helpers import config_validation as cv, aiohttp_client +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from pyhon import Hon @@ -27,7 +27,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: session = aiohttp_client.async_get_clientsession(hass) if (config_dir := hass.config.config_dir) is None: raise ValueError("Missing Config Dir") @@ -54,14 +54,11 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool hass.data[DOMAIN][entry.unique_id] = {"hon": hon, "coordinator": coordinator} await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) - #for platform in PLATFORMS: - # hass.async_create_task( - # hass.config_entries.async_forward_entry_setups(entry, platform) - # ) + return True -async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: refresh_token = hass.data[DOMAIN][entry.unique_id]["hon"].api.auth.refresh_token hass.config_entries.async_update_entry( diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index 23de62e..33a0526 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -7,8 +7,9 @@ from homeassistant.components.binary_sensor import ( BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import callback from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.core import HomeAssistant from .const import DOMAIN from .entity import HonEntity @@ -326,7 +327,7 @@ BINARY_SENSORS["WD"] = unique_entities(BINARY_SENSORS["WM"], BINARY_SENSORS["TD" async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] for device in hass.data[DOMAIN][entry.unique_id]["hon"].appliances: diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index 03e4f5e..4a30ef8 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -4,9 +4,9 @@ from pathlib import Path from homeassistant.components import persistent_notification from homeassistant.components.button import ButtonEntityDescription, ButtonEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant as HomeAssistantType from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.core import HomeAssistant from pyhon.appliance import HonAppliance from .const import DOMAIN @@ -56,7 +56,7 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = { async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities: list[HonButtonType] = [] for device in hass.data[DOMAIN][entry.unique_id]["hon"].appliances: @@ -88,7 +88,7 @@ class HonButtonEntity(HonEntity, ButtonEntity): class HonDeviceInfo(HonEntity, ButtonEntity): def __init__( - self, hass: HomeAssistantType, entry: ConfigEntry, device: HonAppliance + self, hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance ) -> None: super().__init__(hass, entry, device) @@ -108,7 +108,7 @@ class HonDeviceInfo(HonEntity, ButtonEntity): class HonDataArchive(HonEntity, ButtonEntity): def __init__( - self, hass: HomeAssistantType, entry: ConfigEntry, device: HonAppliance + self, hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance ) -> None: super().__init__(hass, entry, device) diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py index 5f574a0..94c03de 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -19,7 +19,7 @@ from homeassistant.const import ( ATTR_TEMPERATURE, UnitOfTemperature, ) -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyhon.appliance import HonAppliance from pyhon.parameter.range import HonParameterRange @@ -103,7 +103,7 @@ CLIMATES: dict[ async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] entity: HonClimateEntity | HonACClimateEntity @@ -129,7 +129,7 @@ class HonACClimateEntity(HonEntity, ClimateEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: HonACClimateEntityDescription, @@ -298,7 +298,7 @@ class HonClimateEntity(HonEntity, ClimateEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: HonClimateEntityDescription, diff --git a/custom_components/hon/entity.py b/custom_components/hon/entity.py index 154ce32..18880c9 100644 --- a/custom_components/hon/entity.py +++ b/custom_components/hon/entity.py @@ -1,7 +1,7 @@ from typing import Optional, Any from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, @@ -19,7 +19,7 @@ class HonEntity(CoordinatorEntity[DataUpdateCoordinator[dict[str, Any]]]): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: Optional[HonEntityDescription] = None, diff --git a/custom_components/hon/fan.py b/custom_components/hon/fan.py index 2432b83..f0ac960 100644 --- a/custom_components/hon/fan.py +++ b/custom_components/hon/fan.py @@ -8,7 +8,7 @@ from homeassistant.components.fan import ( FanEntityFeature, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util.percentage import ( percentage_to_ranged_value, @@ -35,7 +35,7 @@ FANS: dict[str, tuple[FanEntityDescription, ...]] = { async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] for device in hass.data[DOMAIN][entry.unique_id]["hon"].appliances: @@ -55,7 +55,7 @@ class HonFanEntity(HonEntity, FanEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: FanEntityDescription, diff --git a/custom_components/hon/light.py b/custom_components/hon/light.py index 840c5d6..a23f781 100644 --- a/custom_components/hon/light.py +++ b/custom_components/hon/light.py @@ -8,7 +8,7 @@ from homeassistant.components.light import ( ATTR_BRIGHTNESS, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyhon.appliance import HonAppliance from pyhon.parameter.range import HonParameterRange @@ -52,7 +52,7 @@ LIGHTS: dict[str, tuple[LightEntityDescription, ...]] = { async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] for device in hass.data[DOMAIN][entry.unique_id]["hon"].appliances: @@ -72,7 +72,7 @@ class HonLightEntity(HonEntity, LightEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: LightEntityDescription, diff --git a/custom_components/hon/lock.py b/custom_components/hon/lock.py index d098ab0..a98aebe 100644 --- a/custom_components/hon/lock.py +++ b/custom_components/hon/lock.py @@ -3,7 +3,7 @@ from typing import Any from homeassistant.components.lock import LockEntity, LockEntityDescription from homeassistant.config_entries import ConfigEntry -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyhon.parameter.base import HonParameter from pyhon.parameter.range import HonParameterRange @@ -25,7 +25,7 @@ LOCKS: dict[str, tuple[LockEntityDescription, ...]] = { async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] for device in hass.data[DOMAIN][entry.unique_id]["hon"].appliances: diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 9edf360..213aa2b 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -9,7 +9,7 @@ from homeassistant.components.number import ( ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import UnitOfTime, UnitOfTemperature -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyhon.appliance import HonAppliance @@ -218,7 +218,7 @@ NUMBERS["WD"] = unique_entities(NUMBERS["WM"], NUMBERS["TD"]) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] entity: HonNumberEntity | HonConfigNumberEntity @@ -241,7 +241,7 @@ class HonNumberEntity(HonEntity, NumberEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: HonNumberEntityDescription, @@ -300,7 +300,7 @@ class HonConfigNumberEntity(HonEntity, NumberEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: HonConfigNumberEntityDescription, diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index 7eb5bbf..9417c63 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -6,7 +6,7 @@ from dataclasses import dataclass from homeassistant.components.select import SelectEntity, SelectEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.const import UnitOfTemperature, UnitOfTime, REVOLUTIONS_PER_MINUTE -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -221,7 +221,7 @@ SELECTS["WD"] = unique_entities(SELECTS["WM"], SELECTS["TD"]) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] entity: HonSelectEntity | HonConfigSelectEntity diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index 20ae360..091b49c 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -21,7 +21,7 @@ from homeassistant.const import ( UnitOfTime, UnitOfTemperature, ) -from homeassistant.core import HomeAssistant as HomeAssistantType, callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyhon.attributes import HonAttribute @@ -865,7 +865,7 @@ SENSORS["WD"] = unique_entities(SENSORS["WM"], SENSORS["TD"]) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] entity: HonSensorEntity | HonConfigSensorEntity