Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecobee Preset Fix #25256

Merged
merged 5 commits into from
Jul 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions homeassistant/components/ecobee/climate.py
Original file line number Diff line number Diff line change
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