From 8459e921cec3bf73fa1c2aad2e10cf93ad906a92 Mon Sep 17 00:00:00 2001 From: Jon Williams Date: Fri, 6 Feb 2026 17:24:48 +0000 Subject: [PATCH] Fix HomeAssistantType deprecation for Home Assistant 2025.x compatibility Replace deprecated HomeAssistantType with HomeAssistant from homeassistant.core. HomeAssistantType was removed in newer Home Assistant versions, causing ImportError. This updates all imports from homeassistant.helpers.typing to homeassistant.core. Fixes compatibility with Home Assistant 2026.x and later versions. Files updated: - __init__.py - binary_sensor.py - button.py - climate.py - entity.py - fan.py - light.py - lock.py - number.py - select.py - sensor.py - switch.py --- custom_components/hon/__init__.py | 6 +++--- custom_components/hon/binary_sensor.py | 4 ++-- custom_components/hon/button.py | 8 ++++---- custom_components/hon/climate.py | 8 ++++---- custom_components/hon/entity.py | 4 ++-- custom_components/hon/fan.py | 6 +++--- custom_components/hon/light.py | 6 +++--- custom_components/hon/lock.py | 4 ++-- custom_components/hon/number.py | 8 ++++---- custom_components/hon/select.py | 4 ++-- custom_components/hon/sensor.py | 4 ++-- custom_components/hon/switch.py | 4 ++-- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/custom_components/hon/__init__.py b/custom_components/hon/__init__.py index 1e38a2d5..30723930 100644 --- a/custom_components/hon/__init__.py +++ b/custom_components/hon/__init__.py @@ -6,7 +6,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.helpers import config_validation as cv, aiohttp_client -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from pyhon import Hon @@ -27,7 +27,7 @@ ) -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") @@ -60,7 +60,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool 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 39073255..ffc7aa99 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -9,7 +9,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from .const import DOMAIN from .entity import HonEntity @@ -317,7 +317,7 @@ class HonBinarySensorEntityDescription(BinarySensorEntityDescription): 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 ce0f548b..4a30ef82 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -6,7 +6,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from pyhon.appliance import HonAppliance from .const import DOMAIN @@ -56,7 +56,7 @@ 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 @@ def available(self) -> bool: 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 @@ async def async_press(self) -> None: 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 f3ce937c..3a881536 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -21,7 +21,7 @@ ) from homeassistant.core import callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from pyhon.appliance import HonAppliance from pyhon.parameter.range import HonParameterRange @@ -104,7 +104,7 @@ class HonClimateEntityDescription(ClimateEntityDescription): 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 @@ -130,7 +130,7 @@ class HonACClimateEntity(HonEntity, ClimateEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: HonACClimateEntityDescription, @@ -299,7 +299,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 a5970528..0d0b2d42 100644 --- a/custom_components/hon/entity.py +++ b/custom_components/hon/entity.py @@ -3,7 +3,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback from homeassistant.helpers.entity import DeviceInfo -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, ) @@ -20,7 +20,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 a07a08f3..0eb47aae 100644 --- a/custom_components/hon/fan.py +++ b/custom_components/hon/fan.py @@ -10,7 +10,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.util.percentage import ( percentage_to_ranged_value, ranged_value_to_percentage, @@ -36,7 +36,7 @@ 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: @@ -56,7 +56,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 d38a9945..307c47d0 100644 --- a/custom_components/hon/light.py +++ b/custom_components/hon/light.py @@ -10,7 +10,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from pyhon.appliance import HonAppliance from pyhon.parameter.range import HonParameterRange @@ -53,7 +53,7 @@ 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: @@ -73,7 +73,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 1ecb744d..42ad780c 100644 --- a/custom_components/hon/lock.py +++ b/custom_components/hon/lock.py @@ -5,7 +5,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from pyhon.parameter.base import HonParameter from pyhon.parameter.range import HonParameterRange @@ -26,7 +26,7 @@ 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 b646b75e..5e81d265 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -11,7 +11,7 @@ from homeassistant.core import callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from pyhon.appliance import HonAppliance from pyhon.parameter.range import HonParameterRange @@ -207,7 +207,7 @@ class HonNumberEntityDescription(NumberEntityDescription): 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 @@ -230,7 +230,7 @@ class HonNumberEntity(HonEntity, NumberEntity): def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, entry: ConfigEntry, device: HonAppliance, description: HonNumberEntityDescription, @@ -285,7 +285,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 c7da326b..b7421cdd 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -9,7 +9,7 @@ from homeassistant.core import callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from . import const from .const import DOMAIN @@ -211,7 +211,7 @@ class HonConfigSelectEntityDescription(SelectEntityDescription): 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 40392829..24068bc4 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -24,7 +24,7 @@ from homeassistant.core import callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from . import const from .const import DOMAIN @@ -808,7 +808,7 @@ class HonSensorEntityDescription(SensorEntityDescription): 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 diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 359e5052..381b9eb0 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -8,7 +8,7 @@ from homeassistant.core import callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from pyhon.parameter.base import HonParameter from pyhon.parameter.range import HonParameterRange @@ -403,7 +403,7 @@ class HonConfigSwitchEntityDescription(SwitchEntityDescription): async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: AddEntitiesCallback + hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: entities = [] entity: HonConfigSwitchEntity | HonControlSwitchEntity | HonSwitchEntity