Skip to content

Commit

Permalink
Fix eco preset for Wink Air Conditioner (#25763)
Browse files Browse the repository at this point in the history
* Add preset support for device
* Provide mappings between preset changes
  • Loading branch information
cameronrmorris authored and balloob committed Aug 10, 2019
1 parent b79f133 commit f30e54f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions homeassistant/components/wink/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
SUPPORT_PRESET_MODE,
PRESET_NONE,
)
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS
Expand Down Expand Up @@ -62,7 +63,7 @@
SUPPORT_FAN_THERMOSTAT = [FAN_AUTO, FAN_ON]
SUPPORT_PRESET_THERMOSTAT = [PRESET_AWAY, PRESET_ECO]

SUPPORT_FLAGS_AC = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE
SUPPORT_FLAGS_AC = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | SUPPORT_PRESET_MODE
SUPPORT_FAN_AC = [FAN_HIGH, FAN_LOW, FAN_MEDIUM]
SUPPORT_PRESET_AC = [PRESET_NONE, PRESET_ECO]

Expand Down Expand Up @@ -415,10 +416,13 @@ def current_temperature(self):
@property
def preset_mode(self):
"""Return the current preset mode, e.g., home, away, temp."""
if not self.wink.is_on():
return PRESET_NONE

mode = self.wink.current_mode()
if mode == "auto_eco":
return PRESET_ECO
return None
return PRESET_NONE

@property
def preset_modes(self):
Expand All @@ -436,7 +440,7 @@ def hvac_mode(self) -> str:

wink_mode = self.wink.current_mode()
if wink_mode == "auto_eco":
return HVAC_MODE_AUTO
return HVAC_MODE_COOL
return WINK_HVAC_TO_HA.get(wink_mode)

@property
Expand Down Expand Up @@ -476,6 +480,8 @@ def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
if preset_mode == PRESET_ECO:
self.wink.set_operation_mode("auto_eco")
elif self.hvac_mode == HVAC_MODE_COOL and preset_mode == PRESET_NONE:
self.set_hvac_mode(HVAC_MODE_COOL)

@property
def target_temperature(self):
Expand Down

0 comments on commit f30e54f

Please sign in to comment.