mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Implement "Aux Heat" support for Zwave Climate (#25694)
* Remove "Aux Heat" from Zwave climate mappings * Implement Aux Heat support for zwave climate * Pylint fix. * Pylint fix 2nd try
This commit is contained in:
parent
152a9eb466
commit
506350da11
@ -19,6 +19,7 @@ from homeassistant.components.climate.const import (
|
|||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
PRESET_BOOST,
|
PRESET_BOOST,
|
||||||
PRESET_NONE,
|
PRESET_NONE,
|
||||||
|
SUPPORT_AUX_HEAT,
|
||||||
SUPPORT_FAN_MODE,
|
SUPPORT_FAN_MODE,
|
||||||
SUPPORT_SWING_MODE,
|
SUPPORT_SWING_MODE,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
@ -39,8 +40,9 @@ REMOTEC = 0x5254
|
|||||||
REMOTEC_ZXT_120 = 0x8377
|
REMOTEC_ZXT_120 = 0x8377
|
||||||
REMOTEC_ZXT_120_THERMOSTAT = (REMOTEC, REMOTEC_ZXT_120)
|
REMOTEC_ZXT_120_THERMOSTAT = (REMOTEC, REMOTEC_ZXT_120)
|
||||||
ATTR_OPERATING_STATE = "operating_state"
|
ATTR_OPERATING_STATE = "operating_state"
|
||||||
|
ATTR_FAN_STATE = "fan_state"
|
||||||
ATTR_FAN_ACTION = "fan_action"
|
ATTR_FAN_ACTION = "fan_action"
|
||||||
|
AUX_HEAT_ZWAVE_MODE = "Aux Heat"
|
||||||
|
|
||||||
# Device is in manufacturer specific mode (e.g. setting the valve manually)
|
# Device is in manufacturer specific mode (e.g. setting the valve manually)
|
||||||
PRESET_MANUFACTURER_SPECIFIC = "Manufacturer Specific"
|
PRESET_MANUFACTURER_SPECIFIC = "Manufacturer Specific"
|
||||||
@ -54,7 +56,6 @@ HVAC_STATE_MAPPINGS = {
|
|||||||
"heat": HVAC_MODE_HEAT,
|
"heat": HVAC_MODE_HEAT,
|
||||||
"heat mode": HVAC_MODE_HEAT,
|
"heat mode": HVAC_MODE_HEAT,
|
||||||
"heat (default)": HVAC_MODE_HEAT,
|
"heat (default)": HVAC_MODE_HEAT,
|
||||||
"aux heat": HVAC_MODE_HEAT,
|
|
||||||
"furnace": HVAC_MODE_HEAT,
|
"furnace": HVAC_MODE_HEAT,
|
||||||
"fan only": HVAC_MODE_FAN_ONLY,
|
"fan only": HVAC_MODE_FAN_ONLY,
|
||||||
"dry air": HVAC_MODE_DRY,
|
"dry air": HVAC_MODE_DRY,
|
||||||
@ -62,6 +63,7 @@ HVAC_STATE_MAPPINGS = {
|
|||||||
"cool": HVAC_MODE_COOL,
|
"cool": HVAC_MODE_COOL,
|
||||||
"heat_cool": HVAC_MODE_HEAT_COOL,
|
"heat_cool": HVAC_MODE_HEAT_COOL,
|
||||||
"auto": HVAC_MODE_HEAT_COOL,
|
"auto": HVAC_MODE_HEAT_COOL,
|
||||||
|
"auto changeover": HVAC_MODE_HEAT_COOL,
|
||||||
}
|
}
|
||||||
|
|
||||||
HVAC_CURRENT_MAPPINGS = {
|
HVAC_CURRENT_MAPPINGS = {
|
||||||
@ -127,6 +129,7 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
self._hvac_list = None # [zwave_mode]
|
self._hvac_list = None # [zwave_mode]
|
||||||
self._hvac_mapping = None # {ha_mode:zwave_mode}
|
self._hvac_mapping = None # {ha_mode:zwave_mode}
|
||||||
self._hvac_mode = None # ha_mode
|
self._hvac_mode = None # ha_mode
|
||||||
|
self._aux_heat = None
|
||||||
self._default_hvac_mode = None # ha_mode
|
self._default_hvac_mode = None # ha_mode
|
||||||
self._preset_mapping = None # {ha_mode:zwave_mode}
|
self._preset_mapping = None # {ha_mode:zwave_mode}
|
||||||
self._preset_list = None # [zwave_mode]
|
self._preset_list = None # [zwave_mode]
|
||||||
@ -159,6 +162,8 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
support |= SUPPORT_FAN_MODE
|
support |= SUPPORT_FAN_MODE
|
||||||
if self._zxt_120 == 1 and self.values.zxt_120_swing_mode:
|
if self._zxt_120 == 1 and self.values.zxt_120_swing_mode:
|
||||||
support |= SUPPORT_SWING_MODE
|
support |= SUPPORT_SWING_MODE
|
||||||
|
if self._aux_heat:
|
||||||
|
support |= SUPPORT_AUX_HEAT
|
||||||
if self._preset_list:
|
if self._preset_list:
|
||||||
support |= SUPPORT_PRESET_MODE
|
support |= SUPPORT_PRESET_MODE
|
||||||
return support
|
return support
|
||||||
@ -177,7 +182,10 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
for mode in mode_list:
|
for mode in mode_list:
|
||||||
ha_mode = HVAC_STATE_MAPPINGS.get(str(mode).lower())
|
ha_mode = HVAC_STATE_MAPPINGS.get(str(mode).lower())
|
||||||
ha_preset = PRESET_MAPPINGS.get(str(mode).lower())
|
ha_preset = PRESET_MAPPINGS.get(str(mode).lower())
|
||||||
if ha_mode and ha_mode not in self._hvac_mapping:
|
if mode == AUX_HEAT_ZWAVE_MODE:
|
||||||
|
# Aux Heat should not be included in any mapping
|
||||||
|
self._aux_heat = True
|
||||||
|
elif ha_mode and ha_mode not in self._hvac_mapping:
|
||||||
self._hvac_mapping[ha_mode] = mode
|
self._hvac_mapping[ha_mode] = mode
|
||||||
self._hvac_list.append(ha_mode)
|
self._hvac_list.append(ha_mode)
|
||||||
elif ha_preset and ha_preset not in self._preset_mapping:
|
elif ha_preset and ha_preset not in self._preset_mapping:
|
||||||
@ -246,6 +254,7 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
_LOGGER.debug("self._hvac_mode=%s", self._hvac_mode)
|
_LOGGER.debug("self._hvac_mode=%s", self._hvac_mode)
|
||||||
_LOGGER.debug("self._default_hvac_mode=%s", self._default_hvac_mode)
|
_LOGGER.debug("self._default_hvac_mode=%s", self._default_hvac_mode)
|
||||||
_LOGGER.debug("self._hvac_action=%s", self._hvac_action)
|
_LOGGER.debug("self._hvac_action=%s", self._hvac_action)
|
||||||
|
_LOGGER.debug("self._aux_heat=%s", self._aux_heat)
|
||||||
_LOGGER.debug("self._preset_mapping=%s", self._preset_mapping)
|
_LOGGER.debug("self._preset_mapping=%s", self._preset_mapping)
|
||||||
_LOGGER.debug("self._preset_list=%s", self._preset_list)
|
_LOGGER.debug("self._preset_list=%s", self._preset_list)
|
||||||
_LOGGER.debug("self._preset_mode=%s", self._preset_mode)
|
_LOGGER.debug("self._preset_mode=%s", self._preset_mode)
|
||||||
@ -356,6 +365,15 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
"""
|
"""
|
||||||
return self._hvac_action
|
return self._hvac_action
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_aux_heat(self):
|
||||||
|
"""Return true if aux heater."""
|
||||||
|
if not self._aux_heat:
|
||||||
|
return None
|
||||||
|
if self.values.mode.data == AUX_HEAT_ZWAVE_MODE:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def preset_mode(self):
|
def preset_mode(self):
|
||||||
"""Return preset operation ie. eco, away.
|
"""Return preset operation ie. eco, away.
|
||||||
@ -404,6 +422,25 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
|||||||
_LOGGER.debug("Set operation_mode to %s", operation_mode)
|
_LOGGER.debug("Set operation_mode to %s", operation_mode)
|
||||||
self.values.mode.data = operation_mode
|
self.values.mode.data = operation_mode
|
||||||
|
|
||||||
|
def turn_aux_heat_on(self):
|
||||||
|
"""Turn auxillary heater on."""
|
||||||
|
if not self._aux_heat:
|
||||||
|
return
|
||||||
|
operation_mode = AUX_HEAT_ZWAVE_MODE
|
||||||
|
_LOGGER.debug("Aux heat on. Set operation mode to %s", operation_mode)
|
||||||
|
self.values.mode.data = operation_mode
|
||||||
|
|
||||||
|
def turn_aux_heat_off(self):
|
||||||
|
"""Turn auxillary heater off."""
|
||||||
|
if not self._aux_heat:
|
||||||
|
return
|
||||||
|
if HVAC_MODE_HEAT in self._hvac_mapping:
|
||||||
|
operation_mode = self._hvac_mapping.get(HVAC_MODE_HEAT)
|
||||||
|
else:
|
||||||
|
operation_mode = self._hvac_mapping.get(HVAC_MODE_OFF)
|
||||||
|
_LOGGER.debug("Aux heat off. Set operation mode to %s", operation_mode)
|
||||||
|
self.values.mode.data = operation_mode
|
||||||
|
|
||||||
def set_preset_mode(self, preset_mode):
|
def set_preset_mode(self, preset_mode):
|
||||||
"""Set new target preset mode."""
|
"""Set new target preset mode."""
|
||||||
_LOGGER.debug("Set preset_mode to %s", preset_mode)
|
_LOGGER.debug("Set preset_mode to %s", preset_mode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user