From 34800bf5d94e4c3442ceec216a48d6baac263298 Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Thu, 12 Jan 2023 13:08:13 +0100 Subject: [PATCH] filename specification for running as a service --- function/db.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/function/db.py b/function/db.py index 517c92f..c9e7bcc 100644 --- a/function/db.py +++ b/function/db.py @@ -1,5 +1,8 @@ +import os import sqlite3 +db_file = os.path.join(os.path.dirname(__file__), '..', 'database.db') + def get_gui_radiator_data(topic): return __storage__().get_gui_radiator_data(topic) @@ -11,7 +14,7 @@ def set_gui_radiator_data(topic, away_mode, summer_mode, user_temperatur_setpoin class __storage__(object): def __init__(self): - self.conn = sqlite3.connect("database.db") + self.conn = sqlite3.connect(db_file) self.c = self.conn.cursor() with self.conn: self.c.execute("""CREATE TABLE IF NOT EXISTS gui_radiator (