mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Include away temps in target temps
The target temperature methods were not taking the 'away' status into account. leading to misleading target temps being reported.
This commit is contained in:
parent
cd80e41b32
commit
c4a71fbfa7
@ -80,10 +80,9 @@ class NestThermostat(ThermostatDevice):
|
|||||||
@property
|
@property
|
||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
target = self.device.target
|
|
||||||
|
|
||||||
if self.device.mode == 'range':
|
if self.device.mode == 'range':
|
||||||
low, high = target
|
low, high = self.target_temperature_low, \
|
||||||
|
self.target_temperature_high
|
||||||
if self.operation == STATE_COOL:
|
if self.operation == STATE_COOL:
|
||||||
temp = high
|
temp = high
|
||||||
elif self.operation == STATE_HEAT:
|
elif self.operation == STATE_HEAT:
|
||||||
@ -95,13 +94,22 @@ class NestThermostat(ThermostatDevice):
|
|||||||
elif self.current_temperature >= range_average:
|
elif self.current_temperature >= range_average:
|
||||||
temp = high
|
temp = high
|
||||||
else:
|
else:
|
||||||
temp = target
|
if self.is_away_mode_on:
|
||||||
|
# away_temperature is a low, high tuple. Only one should be set
|
||||||
|
# if not in range mode, the other will be None
|
||||||
|
temp = self.device.away_temperature[0] or \
|
||||||
|
self.device.away_temperature[1]
|
||||||
|
else:
|
||||||
|
temp = self.device.target
|
||||||
|
|
||||||
return temp
|
return temp
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature_low(self):
|
def target_temperature_low(self):
|
||||||
"""Return the lower bound temperature we try to reach."""
|
"""Return the lower bound temperature we try to reach."""
|
||||||
|
if self.is_away_mode_on and self.device.away_temperature[0]:
|
||||||
|
# away_temperature is always a low, high tuple
|
||||||
|
return self.device.away_temperature[0]
|
||||||
if self.device.mode == 'range':
|
if self.device.mode == 'range':
|
||||||
return self.device.target[0]
|
return self.device.target[0]
|
||||||
return self.target_temperature
|
return self.target_temperature
|
||||||
@ -109,6 +117,9 @@ class NestThermostat(ThermostatDevice):
|
|||||||
@property
|
@property
|
||||||
def target_temperature_high(self):
|
def target_temperature_high(self):
|
||||||
"""Return the upper bound temperature we try to reach."""
|
"""Return the upper bound temperature we try to reach."""
|
||||||
|
if self.is_away_mode_on and self.device.away_temperature[1]:
|
||||||
|
# away_temperature is always a low, high tuple
|
||||||
|
return self.device.away_temperature[1]
|
||||||
if self.device.mode == 'range':
|
if self.device.mode == 'range':
|
||||||
return self.device.target[1]
|
return self.device.target[1]
|
||||||
return self.target_temperature
|
return self.target_temperature
|
||||||
|
Loading…
x
Reference in New Issue
Block a user