Update opentherm_gw.climate to match Climate 1.0 (#25931)
* Update opentherm_gw.climate to match Climate 1.0 * Change hvac_mode to reflect last active hvac_action
This commit is contained in:
parent
ee45431d0e
commit
26d78cab60
1 changed files with 22 additions and 6 deletions
|
@ -5,11 +5,14 @@ from pyotgw import vars as gw_vars
|
|||
|
||||
from homeassistant.components.climate import ClimateDevice
|
||||
from homeassistant.components.climate.const import (
|
||||
CURRENT_HVAC_COOL,
|
||||
CURRENT_HVAC_HEAT,
|
||||
CURRENT_HVAC_IDLE,
|
||||
HVAC_MODE_COOL,
|
||||
HVAC_MODE_HEAT,
|
||||
HVAC_MODE_OFF,
|
||||
SUPPORT_TARGET_TEMPERATURE,
|
||||
PRESET_AWAY,
|
||||
PRESET_NONE,
|
||||
SUPPORT_PRESET_MODE,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
|
@ -47,8 +50,9 @@ class OpenThermClimate(ClimateDevice):
|
|||
self.friendly_name = gw_dev.name
|
||||
self.floor_temp = gw_dev.climate_config[CONF_FLOOR_TEMP]
|
||||
self.temp_precision = gw_dev.climate_config.get(CONF_PRECISION)
|
||||
self._current_operation = HVAC_MODE_OFF
|
||||
self._current_operation = None
|
||||
self._current_temperature = None
|
||||
self._hvac_mode = HVAC_MODE_HEAT
|
||||
self._new_target_temperature = None
|
||||
self._target_temperature = None
|
||||
self._away_mode_a = None
|
||||
|
@ -70,11 +74,13 @@ class OpenThermClimate(ClimateDevice):
|
|||
flame_on = status.get(gw_vars.DATA_SLAVE_FLAME_ON)
|
||||
cooling_active = status.get(gw_vars.DATA_SLAVE_COOLING_ACTIVE)
|
||||
if ch_active and flame_on:
|
||||
self._current_operation = HVAC_MODE_HEAT
|
||||
self._current_operation = CURRENT_HVAC_HEAT
|
||||
self._hvac_mode = HVAC_MODE_HEAT
|
||||
elif cooling_active:
|
||||
self._current_operation = HVAC_MODE_COOL
|
||||
self._current_operation = CURRENT_HVAC_COOL
|
||||
self._hvac_mode = HVAC_MODE_COOL
|
||||
else:
|
||||
self._current_operation = HVAC_MODE_OFF
|
||||
self._current_operation = CURRENT_HVAC_IDLE
|
||||
|
||||
self._current_temperature = status.get(gw_vars.DATA_ROOM_TEMP)
|
||||
temp_upd = status.get(gw_vars.DATA_ROOM_SETPOINT)
|
||||
|
@ -138,16 +144,25 @@ class OpenThermClimate(ClimateDevice):
|
|||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_action(self):
|
||||
"""Return current HVAC operation."""
|
||||
return self._current_operation
|
||||
|
||||
@property
|
||||
def hvac_mode(self):
|
||||
"""Return current HVAC mode."""
|
||||
return self._current_operation
|
||||
return self._hvac_mode
|
||||
|
||||
@property
|
||||
def hvac_modes(self):
|
||||
"""Return available HVAC modes."""
|
||||
return []
|
||||
|
||||
def set_hvac_mode(self, hvac_mode):
|
||||
"""Set the HVAC mode."""
|
||||
_LOGGER.warning("Changing HVAC mode is not supported")
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -176,6 +191,7 @@ class OpenThermClimate(ClimateDevice):
|
|||
"""Return current preset mode."""
|
||||
if self._away_state_a or self._away_state_b:
|
||||
return PRESET_AWAY
|
||||
return PRESET_NONE
|
||||
|
||||
@property
|
||||
def preset_modes(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue