summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@turin.home>2022-01-16 12:37:08 +0000
committerroot <root@turin.home>2022-01-16 12:37:08 +0000
commit3d049605c99b42b72116e7c334e87053194b79b2 (patch)
treecef66704b0d57efa4df92183007621e859016305
parentcd3de418b669e5ca18bbd515fa6f5cd0febd2696 (diff)
Created thread to update status
-rw-r--r--main.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/main.py b/main.py
index daae78f..c953568 100644
--- a/main.py
+++ b/main.py
@@ -3,8 +3,10 @@ import heating
import errors
import sql
import weather
+import time
from flask import Flask, render_template
+from threading import Thread
app = Flask(__name__)
@@ -74,6 +76,13 @@ def export(opt):
"error.html", error="Invalid export type"
)
+def updater():
+ while True:
+ boiler.update()
+ time.sleep(5)
if __name__ == "__main__":
- app.run(host="0.0.0.0")
+ t1 = Thread(target=app.run, args=(host=host="0.0.0.0",))
+ t2 = Thread(target=updater)
+ t1.start()
+ t2.start()