filename specification for running as a service

This commit is contained in:
Dirk Alders 2023-01-12 13:08:13 +01:00
parent a3e4b8839c
commit 34800bf5d9

View File

@ -1,5 +1,8 @@
import os
import sqlite3 import sqlite3
db_file = os.path.join(os.path.dirname(__file__), '..', 'database.db')
def get_gui_radiator_data(topic): def get_gui_radiator_data(topic):
return __storage__().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): class __storage__(object):
def __init__(self): def __init__(self):
self.conn = sqlite3.connect("database.db") self.conn = sqlite3.connect(db_file)
self.c = self.conn.cursor() self.c = self.conn.cursor()
with self.conn: with self.conn:
self.c.execute("""CREATE TABLE IF NOT EXISTS gui_radiator ( self.c.execute("""CREATE TABLE IF NOT EXISTS gui_radiator (