Skip to content

Commit

Permalink
ecobee Preset Fix (#25256)
Browse files Browse the repository at this point in the history
* ecobee Preset Fix

* Celsius Fix

* Checks Fix

* Check Fix #2

* Check Fix #3
  • Loading branch information
geekofweek authored and balloob committed Jul 18, 2019
1 parent c7ebd10 commit 5c53257
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions homeassistant/components/ecobee/climate.py
Expand Up @@ -31,6 +31,8 @@
PRESET_HOLD_NEXT_TRANSITION = 'next_transition'
PRESET_HOLD_INDEFINITE = 'indefinite'
AWAY_MODE = 'awayMode'
PRESET_HOME = 'home'
PRESET_SLEEP = 'sleep'

# Order matters, because for reverse mapping we don't want to map HEAT to AUX
ECOBEE_HVAC_TO_HASS = collections.OrderedDict([
Expand All @@ -48,9 +50,8 @@

PRESET_MODES = [
PRESET_AWAY,
PRESET_TEMPERATURE,
PRESET_HOLD_NEXT_TRANSITION,
PRESET_HOLD_INDEFINITE
PRESET_HOME,
PRESET_SLEEP
]

SERVICE_SET_FAN_MIN_ON_TIME = 'ecobee_set_fan_min_on_time'
Expand Down Expand Up @@ -305,9 +306,9 @@ def is_aux_heat(self):
"""Return true if aux heater."""
return 'auxHeat' in self.thermostat['equipmentStatus']

def set_preset(self, preset):
def set_preset_mode(self, preset_mode):
"""Activate a preset."""
if preset == self.preset_mode:
if preset_mode == self.preset_mode:
return

self.update_without_throttle = True
Expand All @@ -317,23 +318,26 @@ def set_preset(self, preset):
self.data.ecobee.delete_vacation(
self.thermostat_index, self.vacation)

if preset == PRESET_AWAY:
if preset_mode == PRESET_AWAY:
self.data.ecobee.set_climate_hold(self.thermostat_index, 'away',
'indefinite')

elif preset == PRESET_TEMPERATURE:
elif preset_mode == PRESET_TEMPERATURE:
self.set_temp_hold(self.current_temperature)

elif preset in (PRESET_HOLD_NEXT_TRANSITION, PRESET_HOLD_INDEFINITE):
elif preset_mode in (
PRESET_HOLD_NEXT_TRANSITION, PRESET_HOLD_INDEFINITE):
self.data.ecobee.set_climate_hold(
self.thermostat_index, PRESET_TO_ECOBEE_HOLD[preset],
self.thermostat_index, PRESET_TO_ECOBEE_HOLD[preset_mode],
self.hold_preference())

elif preset is None:
elif preset_mode is None:
self.data.ecobee.resume_program(self.thermostat_index)

else:
_LOGGER.warning("Received invalid preset: %s", preset)
self.data.ecobee.set_climate_hold(
self.thermostat_index, preset_mode, self.hold_preference())
self.update_without_throttle = True

@property
def preset_modes(self):
Expand Down

0 comments on commit 5c53257

Please sign in to comment.