Add hvac_action to HomematicIP Cloud Climate (#28859)
* Add hvac_action to HomematicIP Cloud Climate * update test data * limit hvac action to radiator only * add checks * Fix test to match new conditions
This commit is contained in:
parent
d0c47dfee2
commit
c1163283ff
2 changed files with 34 additions and 0 deletions
|
@ -10,6 +10,8 @@ from homematicip.functionalHomes import IndoorClimateHome
|
|||
|
||||
from homeassistant.components.climate import ClimateDevice
|
||||
from homeassistant.components.climate.const import (
|
||||
CURRENT_HVAC_HEAT,
|
||||
CURRENT_HVAC_IDLE,
|
||||
HVAC_MODE_AUTO,
|
||||
HVAC_MODE_COOL,
|
||||
HVAC_MODE_HEAT,
|
||||
|
@ -140,6 +142,24 @@ class HomematicipHeatingGroup(HomematicipGenericDevice, ClimateDevice):
|
|||
else [HVAC_MODE_AUTO, HVAC_MODE_COOL]
|
||||
)
|
||||
|
||||
@property
|
||||
def hvac_action(self) -> Optional[str]:
|
||||
"""
|
||||
Return the current hvac_action.
|
||||
|
||||
This is only relevant for radiator thermostats.
|
||||
"""
|
||||
if (
|
||||
self._device.floorHeatingMode == "RADIATOR"
|
||||
and self._has_radiator_thermostat
|
||||
and self._heat_mode_enabled
|
||||
):
|
||||
return (
|
||||
CURRENT_HVAC_HEAT if self._device.valvePosition else CURRENT_HVAC_IDLE
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
@property
|
||||
def preset_mode(self) -> Optional[str]:
|
||||
"""Return the current preset mode."""
|
||||
|
|
|
@ -7,8 +7,11 @@ from homematicip.functionalHomes import IndoorClimateHome
|
|||
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
|
||||
from homeassistant.components.climate.const import (
|
||||
ATTR_CURRENT_TEMPERATURE,
|
||||
ATTR_HVAC_ACTION,
|
||||
ATTR_PRESET_MODE,
|
||||
ATTR_PRESET_MODES,
|
||||
CURRENT_HVAC_HEAT,
|
||||
CURRENT_HVAC_IDLE,
|
||||
HVAC_MODE_AUTO,
|
||||
HVAC_MODE_COOL,
|
||||
HVAC_MODE_HEAT,
|
||||
|
@ -215,6 +218,17 @@ async def test_hmip_heating_group_heat(hass, default_mock_hap):
|
|||
# Only fire event from last async_manipulate_test_data available.
|
||||
assert hmip_device.mock_calls[-1][0] == "fire_update_event"
|
||||
|
||||
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)
|
||||
assert ha_state.state == HVAC_MODE_AUTO
|
||||
assert ha_state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_HEAT
|
||||
await async_manipulate_test_data(hass, hmip_device, "floorHeatingMode", "RADIATOR")
|
||||
await async_manipulate_test_data(hass, hmip_device, "valvePosition", 0.0)
|
||||
ha_state = hass.states.get(entity_id)
|
||||
assert ha_state.state == HVAC_MODE_AUTO
|
||||
assert ha_state.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
|
||||
|
||||
async def test_hmip_heating_group_cool(hass, default_mock_hap):
|
||||
"""Test HomematicipHeatingGroup."""
|
||||
|
|
Loading…
Add table
Reference in a new issue