Continue Flask migration.

This commit is contained in:
yohan 2024-06-03 01:01:09 +02:00
parent 4a87b1b1e7
commit 031940a625

View File

@ -199,13 +199,13 @@ class Set_mode_thermostat(Resource):
@auth_required
@api.expect(Set_mode_model, validate=True)
def post(self):
global new_forced_mode
try:
data = Set_mode(**request.json)
except Exception as e:
logging.error(e)
return "K0", 400
new_forced_mode = data.value
xprint(data)
xprint(new_forced_mode)
return "OK", 201
@ -270,6 +270,7 @@ def thermostat_loop():
# dbconn.close()
# break
xprint(new_forced_mode)
if new_forced_mode is not None:
with app.app_context():
data = Set_mode({"value": new_forced_mode})