From 6a3ae353b69c9d04c1d765f0db3042b6b46321c6 Mon Sep 17 00:00:00 2001 From: Khole <29937485+KJonline@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:19:21 +0000 Subject: [PATCH] deps: bump pyhive-integration to 2.0.0b5 and release 2026.11.0b1 Pin pyhive-integration 2.0.0b5, ahead of core's 1.0.10, and set the version to 2026.11.0b1 for the next beta. Restore what 5e63418 reverted, which broke CI and Compatibility: - Map HiveConnectionError to ConfigEntryNotReady, and HiveUnknownConfiguration to ConfigEntryAuthFailed. The tests already expected this and failed to import HiveConnectionError on 1.0.10. - Restore en.json, which had a trailing space hassfest rejects and no options or services strings, and the files the revert reformatted, so ruff passes again. custom_components/ now matches 2026.10.1b2 apart from the manifest. Co-Authored-By: Claude Opus 5.5 --- custom_components/hive/__init__.py | 19 ++- custom_components/hive/binary_sensor.py | 2 +- custom_components/hive/climate.py | 2 +- custom_components/hive/config_flow.py | 25 ++- custom_components/hive/const.py | 1 + custom_components/hive/manifest.json | 4 +- custom_components/hive/sensor.py | 4 +- custom_components/hive/translations/en.json | 166 ++++++++++++++------ 8 files changed, 153 insertions(+), 70 deletions(-) diff --git a/custom_components/hive/__init__.py b/custom_components/hive/__init__.py index 5c2527a..071b7c7 100755 --- a/custom_components/hive/__init__.py +++ b/custom_components/hive/__init__.py @@ -9,7 +9,11 @@ from aiohttp.web_exceptions import HTTPException from apyhiveapi import Auth, Hive -from apyhiveapi.helper.hive_exceptions import HiveReauthRequired +from apyhiveapi.helper.hive_exceptions import ( + HiveConnectionError, + HiveReauthRequired, + HiveUnknownConfiguration, +) from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_SCAN_INTERVAL @@ -43,7 +47,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: HiveConfigEntry) -> bool except HTTPException as error: _LOGGER.error("Could not connect to the internet: %s", error) raise ConfigEntryNotReady from error - except HiveReauthRequired as err: + except HiveConnectionError as error: + _LOGGER.error("Could not fetch devices from Hive: %s", error) + raise ConfigEntryNotReady from error + except (HiveReauthRequired, HiveUnknownConfiguration) as err: raise ConfigEntryAuthFailed from err device_registry = dr.async_get(hass) @@ -89,13 +96,13 @@ async def async_remove_config_entry_device( return True -def refresh_system[_HiveEntityT: HiveEntity, **_P]( - func: Callable[Concatenate[_HiveEntityT, _P], Awaitable[Any]], -) -> Callable[Concatenate[_HiveEntityT, _P], Coroutine[Any, Any, None]]: +def refresh_system[HiveEntityT: HiveEntity, **P]( + func: Callable[Concatenate[HiveEntityT, P], Awaitable[Any]], +) -> Callable[Concatenate[HiveEntityT, P], Coroutine[Any, Any, None]]: """Force update all entities after state change.""" @wraps(func) - async def wrapper(self: _HiveEntityT, *args: _P.args, **kwargs: _P.kwargs) -> None: + async def wrapper(self: HiveEntityT, *args: P.args, **kwargs: P.kwargs) -> None: await func(self, *args, **kwargs) async_dispatcher_send(self.hass, DOMAIN) diff --git a/custom_components/hive/binary_sensor.py b/custom_components/hive/binary_sensor.py index 6fddc41..c89aecb 100755 --- a/custom_components/hive/binary_sensor.py +++ b/custom_components/hive/binary_sensor.py @@ -1 +1 @@ -from homeassistant.components.hive.binary_sensor import * \ No newline at end of file +from homeassistant.components.hive.binary_sensor import * diff --git a/custom_components/hive/climate.py b/custom_components/hive/climate.py index 5db4b4b..5d07024 100755 --- a/custom_components/hive/climate.py +++ b/custom_components/hive/climate.py @@ -1 +1 @@ -from homeassistant.components.hive.climate import * \ No newline at end of file +from homeassistant.components.hive.climate import * diff --git a/custom_components/hive/config_flow.py b/custom_components/hive/config_flow.py index 26174c2..2922fa2 100755 --- a/custom_components/hive/config_flow.py +++ b/custom_components/hive/config_flow.py @@ -4,6 +4,7 @@ from collections.abc import Mapping import copy +import logging from typing import Any from apyhiveapi import Auth @@ -23,7 +24,6 @@ ) from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME from homeassistant.core import callback -import logging from . import HiveConfigEntry from .const import ( @@ -52,7 +52,10 @@ def _walk(node: Any) -> Any: result: dict[str, Any] = {} for key, value in node.items(): key_lower = key.lower() - if any(part in key_lower for part in ("password", "token", "secret", "code", "session")): + if any( + part in key_lower + for part in ("password", "token", "secret", "code", "session") + ): result[key] = _mask(value) else: result[key] = _walk(value) @@ -128,7 +131,11 @@ async def async_step_user( auth_result = self.tokens.get("AuthenticationResult", {}) new_device = auth_result.get("NewDeviceMetadata") or {} access_token = auth_result.get("AccessToken") - if new_device.get("DeviceGroupKey") and new_device.get("DeviceKey") and access_token: + if ( + new_device.get("DeviceGroupKey") + and new_device.get("DeviceKey") + and access_token + ): # If Hive returned fresh device metadata directly from login, register it now # so fallback device auth works when refresh tokens expire. self.hive_auth.access_token = access_token @@ -136,10 +143,16 @@ async def async_step_user( self.hive_auth.device_key = new_device["DeviceKey"] try: await self.hive_auth.device_registration(self.device_name) - self.data["device_data"] = await self.hive_auth.get_device_data() - _LOGGER.debug("Stored Hive device_data from login NewDeviceMetadata.") + self.data[ + "device_data" + ] = await self.hive_auth.get_device_data() + _LOGGER.debug( + "Stored Hive device_data from login NewDeviceMetadata." + ) except HiveApiError: - _LOGGER.warning("Hive device registration failed after login; continuing without device_data.") + _LOGGER.warning( + "Hive device registration failed after login; continuing without device_data." + ) try: return await self.async_setup_hive_entry() diff --git a/custom_components/hive/const.py b/custom_components/hive/const.py index 0caf965..99df0f5 100755 --- a/custom_components/hive/const.py +++ b/custom_components/hive/const.py @@ -1,4 +1,5 @@ """Constants for Hive.""" + from homeassistant.const import Platform ATTR_MODE = "mode" diff --git a/custom_components/hive/manifest.json b/custom_components/hive/manifest.json index ac3c013..dd2d9b6 100755 --- a/custom_components/hive/manifest.json +++ b/custom_components/hive/manifest.json @@ -11,6 +11,6 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/Pyhass/Hive-Custom-Component/issues", "loggers": ["apyhiveapi"], - "requirements": ["pyhive-integration==1.0.10"], - "version": "2026.10.1b2" + "requirements": ["pyhive-integration==2.0.0b5"], + "version": "2026.11.0b1" } diff --git a/custom_components/hive/sensor.py b/custom_components/hive/sensor.py index 0c3030c..378b98a 100755 --- a/custom_components/hive/sensor.py +++ b/custom_components/hive/sensor.py @@ -5,6 +5,8 @@ from datetime import timedelta from typing import Any +from apyhiveapi import Hive + from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, @@ -23,13 +25,11 @@ from . import HiveConfigEntry from .entity import HiveEntity -from apyhiveapi import Hive PARALLEL_UPDATES = 0 SCAN_INTERVAL = timedelta(seconds=15) - @dataclass(frozen=True) class HiveSensorEntityDescription(SensorEntityDescription): """Describes Hive sensor entity.""" diff --git a/custom_components/hive/translations/en.json b/custom_components/hive/translations/en.json index 4ff73ae..90c237a 100755 --- a/custom_components/hive/translations/en.json +++ b/custom_components/hive/translations/en.json @@ -1,62 +1,124 @@ { "config": { - "abort": { - "already_configured": "Account is already configured", - "reauth_successful": "Re-authentication was successful", - "unknown_entry": "Unable to find existing entry." + "step": { + "user": { + "title": "Hive login", + "description": "Enter your Hive login information.", + "data": { + "username": "Username", + "password": "Password", + "disable_2fa_debug": "Disable 2FA (debug)", + "scan_interval": "Scan interval (seconds)" + } }, - "error": { - "invalid_code": "Failed to sign into Hive. Your two-factor authentication code was incorrect.", - "invalid_password": "Failed to sign into Hive. Incorrect password please try again.", - "invalid_username": "Failed to sign into Hive. Your email address is not recognised.", - "twofa_bypassed_debug": "2FA step was intentionally bypassed for debug. Check Home Assistant logs for Hive auth responses.", - "no_internet_available": "An internet connection is required to connect to Hive.", - "unknown": "Unexpected error" + "2fa": { + "title": "Hive two-factor authentication", + "description": "Enter your Hive authentication code.\n\nPlease enter code 0000 to request another code.", + "data": { + "2fa": "Two-factor code" + } }, - "step": { - "2fa": { - "data": { - "2fa": "Two-factor code" - }, - "description": "Enter your Hive authentication code. \n \n Please enter code 0000 to request another code.", - "title": "Hive Two-factor Authentication." - }, - "configuration": { - "data": { - "device_name": "Device Name" - }, - "description": "Enter your Hive configuration ", - "title": "Hive Configuration." - }, - "reauth": { - "data": { - "password": "Password", - "username": "Username" - }, - "description": "Re-enter your Hive login information.", - "title": "Hive Login" - }, - "user": { - "data": { - "password": "Password", - "disable_2fa_debug": "Disable 2FA (debug)", - "scan_interval": "Scan Interval (seconds)", - "username": "Username" - }, - "description": "Enter your Hive login information.", - "title": "Hive Login" - } + "configuration": { + "title": "Hive configuration", + "description": "Enter your Hive configuration.", + "data": { + "device_name": "Device name" + } + }, + "reauth": { + "title": "Hive login", + "description": "Re-enter your Hive login information.", + "data": { + "username": "Username", + "password": "Password" + } } + }, + "error": { + "invalid_username": "Failed to sign in to Hive. Your email address is not recognized.", + "invalid_password": "Failed to sign in to Hive. Incorrect password, please try again.", + "invalid_code": "Failed to sign in to Hive. Your two-factor authentication code was incorrect.", + "twofa_bypassed_debug": "2FA step was intentionally bypassed for debug. Check Home Assistant logs for Hive auth responses.", + "no_internet_available": "An Internet connection is required to connect to Hive.", + "unknown": "Unexpected error" + }, + "abort": { + "already_configured": "Account is already configured", + "unknown_entry": "Unable to find existing entry.", + "reauth_successful": "Re-authentication was successful" + } }, "options": { - "step": { - "user": { - "data": { - "scan_interval": "Scan Interval (seconds)" - }, - "description": "Update the scan interval to poll for data more often.", - "title": "Options for Hive" - } + "step": { + "user": { + "title": "Options for Hive", + "description": "Update the scan interval to poll for data more often.", + "data": { + "scan_interval": "Scan interval (seconds)" + } + } + } + }, + "services": { + "boost_heating_on": { + "name": "Boost heating on", + "description": "Sets the boost mode ON, defining the period of time and the desired target temperature for the boost.", + "fields": { + "time_period": { + "name": "Time period", + "description": "The time period for the boost." + }, + "temperature": { + "name": "Temperature", + "description": "The target temperature for the boost period." + } + } + }, + "boost_heating_off": { + "name": "Boost heating off", + "description": "Sets the boost mode OFF.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "The entity ID to turn boost off." + } + } + }, + "boost_hot_water": { + "name": "Boost hotwater", + "description": "Sets the boost mode ON or OFF, defining the period of time for the boost.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "The entity ID to boost." + }, + "time_period": { + "name": "Time period", + "description": "The time period for the boost." + }, + "on_off": { + "name": "Mode", + "description": "Set the boost function on or off." + } + } + } + }, + "entity": { + "sensor": { + "heating": { + "state": { + "manual": "Manual", + "off": "Off", + "schedule": "Schedule" + } + }, + "hot_water": { + "state": { + "on": "On", + "off": "Off", + "schedule": "Schedule" + } } + } } }