From 17af1a68e859ac49c5a1364f0a8583e41d805363 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@paulusschoutsen.nl> Date: Mon, 1 Jun 2015 22:00:41 -0700 Subject: [PATCH] Fix for Nest thermostats with a range as target temperature --- homeassistant/components/thermostat/nest.py | 16 +++++++++++++++- requirements.txt | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/thermostat/nest.py b/homeassistant/components/thermostat/nest.py index 06adb49a708..af3b02b2b15 100644 --- a/homeassistant/components/thermostat/nest.py +++ b/homeassistant/components/thermostat/nest.py @@ -74,7 +74,21 @@ class NestThermostat(ThermostatDevice): @property def target_temperature(self): """ Returns the temperature we try to reach. """ - return round(self.device.target, 1) + target = self.device.target + + if isinstance(target, tuple): + low, high = target + + if self.current_temperature < low: + target = low + elif self.current_temperature > high: + target = high + else: + target = low + high + else: + temp = target + + return round(temp, 1) @property def is_away_mode_on(self): diff --git a/requirements.txt b/requirements.txt index 24e1f8ff921..a0d9266f850 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,7 +33,7 @@ python-libnmap>=0.6.2 pushbullet.py>=0.7.1 # Nest Thermostat bindings (thermostat.nest) -python-nest>=2.1 +python-nest>=2.3.1 # Z-Wave (*.zwave) pydispatcher>=2.0.5 -- GitLab