Skip to content

Commit

Permalink
Add turn_on method to ecobee climate platform (#27103)
Browse files Browse the repository at this point in the history
* Add turn on method to ecobee climate

* Update climate.py

* Update value in async_update

* Fix update in async_update

* Simplify async_update

* Fix lint complaining about log string

* Cleanup inline if statement
  • Loading branch information
marthoc authored and balloob committed Oct 5, 2019
1 parent 7e7868f commit 2e49303
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions homeassistant/components/ecobee/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def __init__(self, data, thermostat_index):
self.thermostat = self.data.ecobee.get_thermostat(self.thermostat_index)
self._name = self.thermostat["name"]
self.vacation = None
self._last_active_hvac_mode = HVAC_MODE_AUTO

self._operation_list = []
if self.thermostat["settings"]["heatStages"]:
Expand All @@ -289,6 +290,8 @@ async def async_update(self):
else:
await self.data.update()
self.thermostat = self.data.ecobee.get_thermostat(self.thermostat_index)
if self.hvac_mode is not HVAC_MODE_OFF:
self._last_active_hvac_mode = self.hvac_mode

@property
def available(self):
Expand Down Expand Up @@ -700,3 +703,12 @@ def delete_vacation(self, vacation_name):
vacation_name,
)
self.data.ecobee.delete_vacation(self.thermostat_index, vacation_name)

def turn_on(self):
"""Set the thermostat to the last active HVAC mode."""
_LOGGER.debug(
"Turning on ecobee thermostat %s in %s mode",
self.name,
self._last_active_hvac_mode,
)
self.set_hvac_mode(self._last_active_hvac_mode)

0 comments on commit 2e49303

Please sign in to comment.