-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (34 loc) · 978 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import time
from Api.ApiAccess import ApiAccess
from Rules.OpenWindowsNecessary import OpenWindowsNecessary
from Rules.MinRooms import MinRooms
from Rules.Windows import Windows
def output_to_console(lines):
# if os.name in ('nt', 'dos'):
# os.system('cls')
# else:
# os.system('clear')
for line in lines:
print(line)
pass
ruleset = [
MinRooms(),
Windows(),
OpenWindowsNecessary()
]
while True:
suggested_optimizations = []
# Load Data
data = ApiAccess.request_live_data(1)
# Execute all Rules
for rule in ruleset:
if not rule.state_optimal(data.rooms, data.building_data):
suggested_optimizations.append(rule.path_to_opt(data.rooms, data.building_data))
# Output Data
output_to_console(suggested_optimizations)
f = open("suggestions.txt", "w")
f.writelines(suggested_optimizations)
f.close()
time.sleep(5) # Refresh every 5 seconds
pass