diff --git a/thermostat.py b/thermostat.py index 80981bd..f5c2b70 100644 --- a/thermostat.py +++ b/thermostat.py @@ -132,6 +132,8 @@ def get_metric(metric, current_time, interval): def get_forced_mode(): with app.app_context(): row = db.session.execute(db.select(Set_mode.value, Set_mode.timestamp)).first() + if row is None: + return None #cur.execute("SELECT value, timestamp FROM set_mode WHERE name='mode'") #row = cur.fetchone() data = dict(zip(['value', 'timestamp'], row))