commit ca7e83f3f88150864a4dd5344f0f164aee42af16
parent 4239c27de49aef4d5595bfa47366f366a725e6dc
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sun, 28 May 2023 22:10:27 +0200
[GREEN] New set point but time has not come -> required temperature did not change
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/thermostat.py b/thermostat.py
@@ -10,8 +10,11 @@ class Thermostat:
return int(datetime.now().strftime("%H"))
def GetCurrentRequiredTemperature(self):
- if (self.setPoint != None):
- return self.setPoint[1]
+ if self.setPoint != None:
+ if self.GetCurrentTime() >= self.setPoint[0]:
+ return self.setPoint[1]
+ else:
+ return 10
return 10
def AddSetPoint(self, hour, temperature):
@@ -24,7 +27,7 @@ class TestableThermostat(Thermostat):
self.setPoint = None
def GetCurrentTime(self):
- return hour
+ return self.hour
class ThermostatTests(unittest.TestCase):