Support Eco Mode Preset in Climates (#98359)
* Fix #86145 * Add missing test coverage * Add tests for state
This commit is contained in:
parent
91965a74d8
commit
f020d17dd8
2 changed files with 35 additions and 4 deletions
|
@ -180,7 +180,7 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
|||
) or self._has_switch:
|
||||
if not profile_names:
|
||||
presets.append(PRESET_NONE)
|
||||
presets.append(PRESET_BOOST)
|
||||
presets.extend([PRESET_BOOST, PRESET_ECO])
|
||||
|
||||
presets.extend(profile_names)
|
||||
|
||||
|
@ -223,6 +223,8 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
|||
await self._device.set_boost(False)
|
||||
if preset_mode == PRESET_BOOST:
|
||||
await self._device.set_boost()
|
||||
if preset_mode == PRESET_ECO:
|
||||
await self._device.set_control_mode(HMIP_ECO_CM)
|
||||
if preset_mode in self._device_profile_names:
|
||||
profile_idx = self._get_profile_idx_by_name(preset_mode)
|
||||
if self._device.controlMode != HMIP_AUTOMATIC_CM:
|
||||
|
|
|
@ -59,7 +59,12 @@ async def test_hmip_heating_group_heat(
|
|||
assert ha_state.attributes["temperature"] == 5.0
|
||||
assert ha_state.attributes["current_humidity"] == 47
|
||||
assert ha_state.attributes[ATTR_PRESET_MODE] == "STD"
|
||||
assert ha_state.attributes[ATTR_PRESET_MODES] == [PRESET_BOOST, "STD", "Winter"]
|
||||
assert ha_state.attributes[ATTR_PRESET_MODES] == [
|
||||
PRESET_BOOST,
|
||||
PRESET_ECO,
|
||||
"STD",
|
||||
"Winter",
|
||||
]
|
||||
|
||||
service_call_counter = len(hmip_device.mock_calls)
|
||||
|
||||
|
@ -219,6 +224,21 @@ async def test_hmip_heating_group_heat(
|
|||
# Only fire event from last async_manipulate_test_data available.
|
||||
assert hmip_device.mock_calls[-1][0] == "fire_update_event"
|
||||
|
||||
assert ha_state.state == HVACMode.AUTO
|
||||
await hass.services.async_call(
|
||||
"climate",
|
||||
"set_preset_mode",
|
||||
{"entity_id": entity_id, "preset_mode": PRESET_ECO},
|
||||
blocking=True,
|
||||
)
|
||||
assert len(hmip_device.mock_calls) == service_call_counter + 25
|
||||
assert hmip_device.mock_calls[-1][0] == "set_control_mode"
|
||||
assert hmip_device.mock_calls[-1][1] == ("ECO",)
|
||||
await async_manipulate_test_data(hass, hmip_device, "controlMode", "ECO")
|
||||
ha_state = hass.states.get(entity_id)
|
||||
assert ha_state.attributes[ATTR_PRESET_MODE] == PRESET_ECO
|
||||
assert ha_state.state == HVACMode.AUTO
|
||||
|
||||
await async_manipulate_test_data(hass, hmip_device, "floorHeatingMode", "RADIATOR")
|
||||
await async_manipulate_test_data(hass, hmip_device, "valvePosition", 0.1)
|
||||
ha_state = hass.states.get(entity_id)
|
||||
|
@ -376,7 +396,12 @@ async def test_hmip_heating_group_heat_with_switch(
|
|||
assert ha_state.attributes["temperature"] == 5.0
|
||||
assert ha_state.attributes["current_humidity"] == 43
|
||||
assert ha_state.attributes[ATTR_PRESET_MODE] == "STD"
|
||||
assert ha_state.attributes[ATTR_PRESET_MODES] == [PRESET_BOOST, "STD", "P2"]
|
||||
assert ha_state.attributes[ATTR_PRESET_MODES] == [
|
||||
PRESET_BOOST,
|
||||
PRESET_ECO,
|
||||
"STD",
|
||||
"P2",
|
||||
]
|
||||
|
||||
|
||||
async def test_hmip_heating_group_heat_with_radiator(
|
||||
|
@ -401,7 +426,11 @@ async def test_hmip_heating_group_heat_with_radiator(
|
|||
assert ha_state.attributes["max_temp"] == 30.0
|
||||
assert ha_state.attributes["temperature"] == 5.0
|
||||
assert ha_state.attributes[ATTR_PRESET_MODE] is None
|
||||
assert ha_state.attributes[ATTR_PRESET_MODES] == [PRESET_NONE, PRESET_BOOST]
|
||||
assert ha_state.attributes[ATTR_PRESET_MODES] == [
|
||||
PRESET_NONE,
|
||||
PRESET_BOOST,
|
||||
PRESET_ECO,
|
||||
]
|
||||
|
||||
|
||||
async def test_hmip_climate_services(
|
||||
|
|
Loading…
Add table
Reference in a new issue