Map Modes to setpoint indexes (#3023)

* Map Modes to setpoint indexes

* Fixes devices with no thermostat mode

* another try to fix devices without mode

* another try to fix devices without mode 2

* another try to fix devices without mode 3

* fix setting setpoint for devices with no mode

* fix setting setpoint for devices with no mode
pull/3027/head
John Arild Berentsen 2016-08-28 22:41:48 +02:00 committed by GitHub
parent 3313995c4c
commit 2a5ca1c873
1 changed files with 33 additions and 12 deletions

View File

@ -35,11 +35,21 @@ DEVICE_MAPPINGS = {
REMOTEC_ZXT_120_THERMOSTAT: WORKAROUND_ZXT_120
}
ZXT_120_SET_TEMP = {
SET_TEMP_TO_INDEX = {
'Heat': 1,
'Cool': 2,
'Auto': 3,
'Aux Heat': 4,
'Resume': 5,
'Fan Only': 6,
'Furnace': 7,
'Dry Air': 8,
'Auto Changeover': 10
'Moist Air': 9,
'Auto Changeover': 10,
'Heat Econ': 11,
'Cool Econ': 12,
'Away': 13,
'Unknown': 14
}
@ -109,7 +119,14 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
for value in self._node.get_values(
class_id=COMMAND_CLASS_THERMOSTAT_SETPOINT).values():
self._unit = value.units
if self.current_operation is not None:
if SET_TEMP_TO_INDEX.get(self._current_operation) \
!= value.index:
continue
if self._zxt_120:
continue
self._target_temperature = int(value.data)
# Operation Mode
for value in self._node.get_values(
class_id=COMMAND_CLASS_THERMOSTAT_MODE).values():
@ -203,21 +220,25 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
"""Set new target temperature."""
for value in self._node.get_values(
class_id=COMMAND_CLASS_THERMOSTAT_SETPOINT).values():
if self._zxt_120:
# ZXT-120 does not support get setpoint
self._target_temperature = temperature
if ZXT_120_SET_TEMP.get(self._current_operation) \
!= value.index:
if self.current_operation is not None:
if SET_TEMP_TO_INDEX.get(self._current_operation) \
!= value.index:
continue
_LOGGER.debug("ZXT_120_SET_TEMP=%s and"
_LOGGER.debug("SET_TEMP_TO_INDEX=%s and"
" self._current_operation=%s",
ZXT_120_SET_TEMP.get(self._current_operation),
SET_TEMP_TO_INDEX.get(self._current_operation),
self._current_operation)
# ZXT-120 responds only to whole int
value.data = int(round(temperature, 0))
if self._zxt_120:
# ZXT-120 does not support get setpoint
self._target_temperature = temperature
# ZXT-120 responds only to whole int
value.data = int(round(temperature, 0))
else:
value.data = int(temperature)
break
else:
value.data = int(temperature)
break
break
def set_fan_mode(self, fan):
"""Set new target fan mode."""