Continue Flask migration.
This commit is contained in:
parent
36b53462cb
commit
944018f762
@ -220,29 +220,29 @@ first_loop = True
|
||||
|
||||
def thermostat_loop():
|
||||
while True:
|
||||
# # if stop.is_set():
|
||||
# # httpd.shutdown()
|
||||
# # httpd.server_close()
|
||||
# # dbconn.close()
|
||||
# # break
|
||||
#
|
||||
# if new_forced_mode is not None:
|
||||
# with app.app_context():
|
||||
# data = Set_mode({"value": new_forced_mode})
|
||||
# db.session.add(data)
|
||||
# db.session.commit()
|
||||
# if stop.is_set():
|
||||
# httpd.shutdown()
|
||||
# httpd.server_close()
|
||||
# dbconn.close()
|
||||
# break
|
||||
|
||||
if new_forced_mode is not None:
|
||||
with app.app_context():
|
||||
data = Set_mode({"value": new_forced_mode})
|
||||
db.session.add(data)
|
||||
db.session.commit()
|
||||
# #cursor.execute("INSERT OR REPLACE INTO set_mode (value) VALUES ('"+new_forced_mode+"')")
|
||||
# #dbconn.commit()
|
||||
# logging.info("Switch to "+new_forced_mode)
|
||||
# target_name = new_forced_mode
|
||||
# new_forced_mode = None
|
||||
# # Force immediate action:
|
||||
# last_control_time = None
|
||||
# current_time = time.time()
|
||||
# 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_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()
|
||||
logging.info("Switch to "+new_forced_mode)
|
||||
target_name = new_forced_mode
|
||||
new_forced_mode = None
|
||||
# Force immediate action:
|
||||
last_control_time = None
|
||||
current_time = time.time()
|
||||
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_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()
|
||||
# if forced_mode is not None and forced_mode in targets:
|
||||
# if target_name != forced_mode:
|
||||
# target_name = forced_mode
|
||||
|
Loading…
Reference in New Issue
Block a user