Continue Flask migration.

This commit is contained in:
yohan 2024-06-02 14:45:26 +02:00
parent 36b53462cb
commit 944018f762

View File

@ -220,29 +220,29 @@ first_loop = True
def thermostat_loop(): def thermostat_loop():
while True: while True:
# # if stop.is_set(): # if stop.is_set():
# # httpd.shutdown() # httpd.shutdown()
# # httpd.server_close() # httpd.server_close()
# # dbconn.close() # dbconn.close()
# # break # break
#
# if new_forced_mode is not None: if new_forced_mode is not None:
# with app.app_context(): with app.app_context():
# data = Set_mode({"value": new_forced_mode}) data = Set_mode({"value": new_forced_mode})
# db.session.add(data) db.session.add(data)
# db.session.commit() db.session.commit()
# #cursor.execute("INSERT OR REPLACE INTO set_mode (value) VALUES ('"+new_forced_mode+"')") # #cursor.execute("INSERT OR REPLACE INTO set_mode (value) VALUES ('"+new_forced_mode+"')")
# #dbconn.commit() # #dbconn.commit()
# logging.info("Switch to "+new_forced_mode) logging.info("Switch to "+new_forced_mode)
# target_name = new_forced_mode target_name = new_forced_mode
# new_forced_mode = None new_forced_mode = None
# # Force immediate action: # Force immediate action:
# last_control_time = None last_control_time = None
# current_time = time.time() current_time = time.time()
# current_date = datetime.now() current_date = datetime.now()
# today_awake_time = current_date.replace(hour=int(awake_hour.split(':')[0]), minute=int(awake_hour.split(':')[1]), second=0, microsecond=0) today_awake_time = current_date.replace(hour=int(awake_hour.split(':')[0]), minute=int(awake_hour.split(':')[1]), second=0, microsecond=0)
# today_sleep_time = current_date.replace(hour=int(sleep_hour.split(':')[0]), minute=int(sleep_hour.split(':')[1]), second=0, microsecond=0) today_sleep_time = current_date.replace(hour=int(sleep_hour.split(':')[0]), minute=int(sleep_hour.split(':')[1]), second=0, microsecond=0)
# forced_mode = get_forced_mode() forced_mode = get_forced_mode()
# if forced_mode is not None and forced_mode in targets: # if forced_mode is not None and forced_mode in targets:
# if target_name != forced_mode: # if target_name != forced_mode:
# target_name = forced_mode # target_name = forced_mode