summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.py b/main.py
index 58d8291..f42b319 100644
--- a/main.py
+++ b/main.py
@@ -4,6 +4,7 @@ import errors
import sql
import weather
import time
+import api
from flask import Flask, render_template, redirect, url_for
from threading import Thread
@@ -36,6 +37,7 @@ def main_page():
# paramaterised location of template in 'templates' folder
return render_template(
"main.html",
+ # Rounding value for user interface so number is not too long
actual_temp=round(boiler.temperature,2),
target_temp=boiler.target,
forecast_temp=weather.temperature()
@@ -77,6 +79,8 @@ def export(opt):
"error.html", error="Invalid export type"
)
+# Methods that will run continously: the update script for the heating
+# and the flask webapp
def updater():
while True:
@@ -89,6 +93,8 @@ def webapp():
if __name__ == "__main__":
+ # Start the two main methods as threads
+ # Use of multithreaded processing
t1 = Thread(target=webapp)
t2 = Thread(target=updater)
t1.start()