Bump huum to 0.8.4 (#189893)

Co-authored-by: Muskelkatermann <4005986+Muskelkatermann@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Muskelkatermann
2026-11-02 10:17:09 +00:00
committed by GitHub
co-authored by Muskelkatermann Claude Opus 5.5
parent 768b48d547
commit 513fe7d524
7 changed files with 124 additions and 5 deletions
+1 -1
View File
@@ -9,5 +9,5 @@
"integration_type": "device",
"iot_class": "cloud_polling",
"quality_scale": "silver",
"requirements": ["huum==0.8.2"]
"requirements": ["huum==0.8.4"]
}
+12
View File
@@ -54,6 +54,18 @@ class HuumSteamer(HuumBaseEntity, NumberEntity):
"""Return the current value."""
return self.coordinator.data.humidity
@property
@override
def native_max_value(self) -> float:
"""Return the maximum value."""
# The allowed steamer level drops as the target temperature rises.
data = self.coordinator.data
if data.maximum_target_humidity is not None:
return data.maximum_target_humidity
if data.target_temperature is not None:
return self.coordinator.huum.get_max_humidity(data.target_temperature)
return super().native_max_value
@override
async def async_set_native_value(self, value: float) -> None:
"""Update the current value."""
+1 -1
View File
@@ -1385,7 +1385,7 @@ horimote==0.4.1
huawei-lte-api==1.11.0
# homeassistant.components.huum
huum==0.8.2
huum==0.8.4
# homeassistant.components.hydroquebec_peak
hydropeak-opendata==0.2.0
+1
View File
@@ -36,6 +36,7 @@ def mock_huum_client() -> Generator[AsyncMock]:
config=3,
light=1,
humidity=5,
maximum_target_humidity=20,
sauna_config=SaunaConfig(
child_lock="OFF",
max_heating_time=3,
@@ -13,6 +13,8 @@
'humidity': 5,
'is_private': None,
'light': 1,
'maximum_target_humidity': 20,
'measured_humidity': None,
'payment_end_date': None,
'remote_safety_state': None,
'sauna_config': dict({
@@ -6,7 +6,7 @@
]),
'area_id': None,
'capabilities': dict({
<NumberEntityCapabilityAttribute.MAX: 'max'>: 40,
<NumberEntityCapabilityAttribute.MAX: 'max'>: 20,
<NumberEntityCapabilityAttribute.MIN: 'min'>: 0,
<NumberEntityCapabilityAttribute.MODE: 'mode'>: <NumberMode.AUTO: 'auto'>,
<NumberEntityCapabilityAttribute.STEP: 'step'>: 1,
@@ -46,7 +46,7 @@
'attributes': ReadOnlyDict({
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'humidity',
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Huum sauna Humidity',
<NumberEntityCapabilityAttribute.MAX: 'max'>: 40,
<NumberEntityCapabilityAttribute.MAX: 'max'>: 20,
<NumberEntityCapabilityAttribute.MIN: 'min'>: 0,
<NumberEntityCapabilityAttribute.MODE: 'mode'>: <NumberMode.AUTO: 'auto'>,
<NumberEntityCapabilityAttribute.STEP: 'step'>: 1,
+105 -1
View File
@@ -1,6 +1,6 @@
"""Tests for the Huum number entity."""
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, patch
from huum.const import SaunaStatus
import pytest
@@ -8,12 +8,14 @@ from pytest_homeassistant.common import MockConfigEntry, snapshot_platform
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.number import (
ATTR_MAX,
ATTR_VALUE,
DOMAIN as NUMBER_DOMAIN,
SERVICE_SET_VALUE,
)
from homeassistant.const import ATTR_ENTITY_ID, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import entity_registry as er
ENTITY_ID = "number.huum_sauna_humidity"
@@ -74,3 +76,105 @@ async def test_dont_set_humidity_when_sauna_not_heating(
)
mock_huum_client.turn_on.assert_not_called()
async def setup_number_platform(
hass: HomeAssistant, mock_config_entry: MockConfigEntry
) -> None:
"""Set up the integration with only the number platform."""
mock_config_entry.add_to_hass(hass)
with patch("homeassistant.components.huum.PLATFORMS", [Platform.NUMBER]):
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
async def test_set_humidity_above_controller_maximum(
hass: HomeAssistant,
mock_huum_client: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test humidity above the maximum reported by the controller is rejected."""
mock_huum_client.status.return_value.status = SaunaStatus.ONLINE_HEATING
mock_huum_client.status.return_value.maximum_target_humidity = 10
await setup_number_platform(hass, mock_config_entry)
assert hass.states.get(ENTITY_ID).attributes[ATTR_MAX] == 10
with pytest.raises(ServiceValidationError):
await hass.services.async_call(
NUMBER_DOMAIN,
SERVICE_SET_VALUE,
{
ATTR_ENTITY_ID: ENTITY_ID,
ATTR_VALUE: 20,
},
blocking=True,
)
mock_huum_client.turn_on.assert_not_called()
async def test_set_humidity_at_controller_maximum(
hass: HomeAssistant,
mock_huum_client: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test humidity equal to the maximum reported by the controller is set."""
mock_huum_client.status.return_value.status = SaunaStatus.ONLINE_HEATING
mock_huum_client.status.return_value.maximum_target_humidity = 10
await setup_number_platform(hass, mock_config_entry)
await hass.services.async_call(
NUMBER_DOMAIN,
SERVICE_SET_VALUE,
{
ATTR_ENTITY_ID: ENTITY_ID,
ATTR_VALUE: 10,
},
blocking=True,
)
mock_huum_client.turn_on.assert_awaited_once_with(temperature=80, humidity=10)
async def test_humidity_maximum_without_controller_value(
hass: HomeAssistant,
mock_huum_client: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test the library limit is used when the controller reports no maximum."""
mock_huum_client.status.return_value.status = SaunaStatus.ONLINE_HEATING
mock_huum_client.status.return_value.target_temperature = 95
mock_huum_client.status.return_value.maximum_target_humidity = None
mock_huum_client.get_max_humidity.return_value = 0
await setup_number_platform(hass, mock_config_entry)
assert hass.states.get(ENTITY_ID).attributes[ATTR_MAX] == 0
mock_huum_client.get_max_humidity.assert_called_with(95)
with pytest.raises(ServiceValidationError):
await hass.services.async_call(
NUMBER_DOMAIN,
SERVICE_SET_VALUE,
{
ATTR_ENTITY_ID: ENTITY_ID,
ATTR_VALUE: 5,
},
blocking=True,
)
mock_huum_client.turn_on.assert_not_called()
async def test_humidity_maximum_without_target_temperature(
hass: HomeAssistant,
mock_huum_client: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test the default maximum is used without a reported maximum or target."""
mock_huum_client.status.return_value.target_temperature = None
mock_huum_client.status.return_value.maximum_target_humidity = None
await setup_number_platform(hass, mock_config_entry)
assert hass.states.get(ENTITY_ID).attributes[ATTR_MAX] == 40
mock_huum_client.get_max_humidity.assert_not_called()