Skip to content

Commit db0090d

Browse files
Paul JenningsPaul Jennings
authored andcommitted
Actually check acceptable heat/cool range.
1 parent 4ecaa23 commit db0090d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

TStatGcal.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,19 @@ def main(tstatAddr, username=None, password=None, calName="Thermostat"):
147147
print "Closest event: %s at %s" % (text, closestDT)
148148
(command, value) = text.splitlines()[0].split()
149149
if command == 'Heat':
150-
print "Setting heat to %s" % int(value)
151-
tstat.setHeatPoint(int(value))
150+
value = int(value)
151+
if value >= HEAT_MIN and value <= HEAT_MAX:
152+
print "Setting heat to %s" % int(value)
153+
tstat.setHeatPoint(value)
154+
else:
155+
print "Value out of acceptable heat range:", value
152156
elif command == 'Cool':
153-
print "Setting cool to %s" % value
154-
tstat.setCoolPoint(int(value))
157+
value = int(value)
158+
if value >= COOL_MIN and value <= COOL_MAX:
159+
print "Setting cool to %s" % value
160+
tstat.setCoolPoint(int(value))
161+
else:
162+
print "Value out of acceptable cool range:", value
155163
elif command == 'Fan':
156164
print "Setting fan to %s" % value
157165
tstat.setFanMode(value)

0 commit comments

Comments
 (0)