From 942d722dcf8e2ccd5fef0775f689ac87b7926e81 Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Tue, 12 Apr 2016 18:25:24 -0400 Subject: [PATCH] Improve target temperature selection logic When picking which of the high/low temperatures to display as the "target", it makes more sense to take the outside temperature into consideration, rather than the current temperature of the thermostat. If the temperature outside is less than the temperature of the thermostat, then we are far more likely to end up in "heating" mode eventually, and vice versa, regardless of where the current inside temp falls in the range between high and low. --- homeassistant/components/thermostat/nest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/thermostat/nest.py b/homeassistant/components/thermostat/nest.py index 2426e638c43..7f78b4b2238 100644 --- a/homeassistant/components/thermostat/nest.py +++ b/homeassistant/components/thermostat/nest.py @@ -88,8 +88,10 @@ class NestThermostat(ThermostatDevice): elif self.operation == STATE_HEAT: temp = low else: - range_average = (low + high)/2 - if self.current_temperature < range_average: + # If the outside temp is lower than the current temp, consider + # the 'low' temp to the target, otherwise use the high temp + if (self.device.structure.weather.current.temperature < + self.current_temperature): temp = low elif self.current_temperature >= range_average: temp = high