-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.py
More file actions
24 lines (19 loc) · 734 Bytes
/
program.py
File metadata and controls
24 lines (19 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# get prediction in the morning and program thermostat auto mode
import datetime
import autoModeUtil
from apis.Thermostat import Thermostat
# get actual time
now = datetime.datetime.now()
# print("Current time:", now)
# get next full half hour
if now.minute < 30:
next_half_hour = now.replace(minute=30, second=0, microsecond=0)
else:
next_half_hour = (now + datetime.timedelta(hours=1)).replace(minute=0, second=0, microsecond=0)
print("Next half hour:", next_half_hour)
times, targetTemps = autoModeUtil.readPrediction(next_half_hour)
# program auto mode of thermostat
weekday = autoModeUtil.programAutoMode(times, targetTemps)
print("weekday:", weekday)
thermostat1 = Thermostat()
thermostat1.programAutoMode(weekday)