From 1ef4ada723d4f1353dfa387ef1495b52ef1e2b41 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Wed, 5 Jun 2024 07:20:35 +0200 Subject: [PATCH] Add debug. --- thermostat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thermostat.py b/thermostat.py index 13a3397..1173881 100644 --- a/thermostat.py +++ b/thermostat.py @@ -274,11 +274,14 @@ def thermostat_loop(): with app.app_context(): data = Set_mode(value=new_forced_mode) try: + logging.debug("Insert mode in DB") db.session.add(data) db.session.commit() except sqlalchemy.exc.IntegrityError as e: try: + logging.debug("Row already exists in DB.") db.session.rollback() + logging.debug("Update mode in DB") cur_mode = db.session.execute(db.select(Set_mode).filter_by(name="mode")).scalar_one() cur_mode = data db.session.commit()