Add debug.
This commit is contained in:
parent
d238c86099
commit
1ef4ada723
@ -274,11 +274,14 @@ def thermostat_loop():
|
|||||||
with app.app_context():
|
with app.app_context():
|
||||||
data = Set_mode(value=new_forced_mode)
|
data = Set_mode(value=new_forced_mode)
|
||||||
try:
|
try:
|
||||||
|
logging.debug("Insert mode in DB")
|
||||||
db.session.add(data)
|
db.session.add(data)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except sqlalchemy.exc.IntegrityError as e:
|
except sqlalchemy.exc.IntegrityError as e:
|
||||||
try:
|
try:
|
||||||
|
logging.debug("Row already exists in DB.")
|
||||||
db.session.rollback()
|
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 = db.session.execute(db.select(Set_mode).filter_by(name="mode")).scalar_one()
|
||||||
cur_mode = data
|
cur_mode = data
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user