ecobee Preset Fix (#25256)

* ecobee Preset Fix

* Celsius Fix

* Checks Fix

* Check Fix #2

* Check Fix #3
pull/25280/head
geekofweek 2019-07-18 12:39:53 -05:00 committed by Paulus Schoutsen
parent 37810e010a
commit 2016cf872e
1 changed files with 15 additions and 11 deletions

View File

@ -31,6 +31,8 @@ PRESET_AUX_HEAT_ONLY = 'aux_heat_only'
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([
@ -48,9 +50,8 @@ PRESET_TO_ECOBEE_HOLD = {
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'
@ -305,9 +306,9 @@ class Thermostat(ClimateDevice):
"""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
@ -317,23 +318,26 @@ class Thermostat(ClimateDevice):
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):