From b34101b2777388feb9b507dc567f4309fbc76c55 Mon Sep 17 00:00:00 2001 From: Josh Nichols Date: Sun, 18 Sep 2016 16:20:06 -0400 Subject: [PATCH] Update Ecobee state after making changes to climate (#3436) * Update Ecobee state after making changes to climate Without this, climate and sensor state will take up to 3 minutes (the MIN_TIME_BETWEEN_UPDATES on its update throttle) to update in the interface, which makes it more difficult to do automation around the state. * Use a boolean instance variable that update can check, rather than always calling update --- homeassistant/components/climate/ecobee.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/climate/ecobee.py b/homeassistant/components/climate/ecobee.py index 21a2c89c31a..8c090818442 100644 --- a/homeassistant/components/climate/ecobee.py +++ b/homeassistant/components/climate/ecobee.py @@ -86,10 +86,16 @@ class Thermostat(ClimateDevice): self.hold_temp = hold_temp self._operation_list = ['auto', 'auxHeatOnly', 'cool', 'heat', 'off'] + self.update_without_throttle = False def update(self): """Get the latest state from the thermostat.""" - self.data.update() + if self.update_without_throttle: + self.data.update(no_throttle=True) + self.update_without_throttle = False + else: + self.data.update() + self.thermostat = self.data.ecobee.get_thermostat( self.thermostat_index) @@ -211,10 +217,12 @@ class Thermostat(ClimateDevice): "away", "indefinite") else: self.data.ecobee.set_climate_hold(self.thermostat_index, "away") + self.update_without_throttle = True def turn_away_mode_off(self): """Turn away off.""" self.data.ecobee.resume_program(self.thermostat_index) + self.update_without_throttle = True def set_temperature(self, **kwargs): """Set new target temperature.""" @@ -241,15 +249,18 @@ class Thermostat(ClimateDevice): "high=%s, is=%s", low_temp, isinstance( low_temp, (int, float)), high_temp, isinstance(high_temp, (int, float))) + self.update_without_throttle = True def set_operation_mode(self, operation_mode): """Set HVAC mode (auto, auxHeatOnly, cool, heat, off).""" self.data.ecobee.set_hvac_mode(self.thermostat_index, operation_mode) + self.update_without_throttle = True def set_fan_min_on_time(self, fan_min_on_time): """Set the minimum fan on time.""" self.data.ecobee.set_fan_min_on_time(self.thermostat_index, fan_min_on_time) + self.update_without_throttle = True # Home and Sleep mode aren't used in UI yet: