Skip to content

Commit

Permalink
separate away and off
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Jan 19, 2020
1 parent ae2357a commit 8ee9afc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions custom_components/qubino_wire_pilot/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,26 @@ def heater_value(self):
@property
def preset_modes(self):
"""List of available preset modes."""
return [PRESET_COMFORT, PRESET_ECO]
return [PRESET_COMFORT, PRESET_ECO, PRESET_AWAY]

@property
def preset_mode(self):
value = self.heater_value

if value <= VALUE_FROST:
if value <= VALUE_OFF:
return PRESET_NONE
elif value <= VALUE_FROST:
return PRESET_AWAY
elif value <= VALUE_ECO:
return PRESET_ECO
else:
return PRESET_COMFORT

async def async_set_preset_mode(self, preset_mode):
value = VALUE_FROST
value = VALUE_OFF

if preset_mode == PRESET_AWAY:
value = VALUE_FROST
if preset_mode == PRESET_ECO:
value = VALUE_ECO
elif preset_mode == PRESET_COMFORT:
Expand All @@ -183,15 +187,15 @@ async def async_set_hvac_mode(self, hvac_mode):
if hvac_mode == HVAC_MODE_HEAT:
value = VALUE_COMFORT
elif hvac_mode == HVAC_MODE_OFF:
value = VALUE_FROST
value = VALUE_OFF

await self._async_set_heater_value(value)

@property
def hvac_mode(self):
value = self.heater_value

if value <= VALUE_FROST:
if value <= VALUE_OFF:
return HVAC_MODE_OFF
else:
return HVAC_MODE_HEAT
Expand Down

0 comments on commit 8ee9afc

Please sign in to comment.