mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 14:29:21 -04:00
Raise Qube heat pump to the silver quality scale (#183881)
This commit is contained in:
@@ -7,6 +7,6 @@
|
||||
"integration_type": "hub",
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["python_qube_heatpump"],
|
||||
"quality_scale": "bronze",
|
||||
"quality_scale": "silver",
|
||||
"requirements": ["python-qube-heatpump==1.15.0"]
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ rules:
|
||||
unique-config-entry: done
|
||||
|
||||
# Silver
|
||||
action-exceptions:
|
||||
status: exempt
|
||||
comment: Integration does not register custom actions.
|
||||
action-exceptions: done
|
||||
config-entry-unloading: done
|
||||
docs-configuration-parameters:
|
||||
status: exempt
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.components.water_heater import (
|
||||
STATE_HEAT_PUMP,
|
||||
STATE_PERFORMANCE,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
@@ -61,15 +61,26 @@ async def test_set_temperature(
|
||||
mock_qube_client.write_setpoint.assert_awaited_once_with("setpoint_dhw", 55)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("side_effect", "return_value"),
|
||||
[
|
||||
(ConnectionError, None),
|
||||
(None, False),
|
||||
],
|
||||
)
|
||||
async def test_set_temperature_failure(
|
||||
hass: HomeAssistant,
|
||||
mock_qube_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
side_effect: type[Exception] | None,
|
||||
return_value: bool | None,
|
||||
) -> None:
|
||||
"""Test set temperature raises HomeAssistantError on failure."""
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
mock_qube_client.write_setpoint = AsyncMock(return_value=False)
|
||||
mock_qube_client.write_setpoint = AsyncMock(
|
||||
side_effect=side_effect, return_value=return_value
|
||||
)
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
WATER_HEATER_DOMAIN,
|
||||
@@ -108,6 +119,35 @@ async def test_set_operation_mode(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("side_effect", "return_value"),
|
||||
[
|
||||
(ConnectionError, None),
|
||||
(None, False),
|
||||
],
|
||||
)
|
||||
async def test_set_operation_mode_failure(
|
||||
hass: HomeAssistant,
|
||||
mock_qube_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
side_effect: type[Exception] | None,
|
||||
return_value: bool | None,
|
||||
) -> None:
|
||||
"""Test set operation mode raises HomeAssistantError on failure."""
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
mock_qube_client.write_switch = AsyncMock(
|
||||
side_effect=side_effect, return_value=return_value
|
||||
)
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
WATER_HEATER_DOMAIN,
|
||||
SERVICE_SET_OPERATION_MODE,
|
||||
{ATTR_ENTITY_ID: ENTITY_ID, ATTR_OPERATION_MODE: STATE_PERFORMANCE},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
|
||||
async def test_current_operation_boost(
|
||||
hass: HomeAssistant,
|
||||
mock_qube_client: MagicMock,
|
||||
@@ -122,3 +162,19 @@ async def test_current_operation_boost(
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state is not None
|
||||
assert state.attributes["operation_mode"] == STATE_PERFORMANCE
|
||||
|
||||
|
||||
async def test_current_operation_unknown(
|
||||
hass: HomeAssistant,
|
||||
mock_qube_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test current operation is unknown when the boost coil cannot be read."""
|
||||
mock_qube_client.read_all_switches.return_value["tapw_timeprogram_bms_forced"] = (
|
||||
None
|
||||
)
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state is not None
|
||||
assert state.state == STATE_UNKNOWN
|
||||
|
||||
Reference in New Issue
Block a user