diff --git a/src/endpoints/handlers/bett.py b/src/endpoints/handlers/bett.py index a4f27d1..91f174d 100644 --- a/src/endpoints/handlers/bett.py +++ b/src/endpoints/handlers/bett.py @@ -8,7 +8,7 @@ import requests as r from ..hue import hue file_path: str = "bettwaage.csv" -header: str = "timestamp;tl;tr;bl;br;total;" +header: str = "timestamp;tl;tr;bl;br;total;\n" bett_ip: str = "http://192.168.178.110:80" matrix_clock_api: str = "http://192.168.178.84:8000" @@ -113,9 +113,10 @@ def check_for_change(): def add_line_to_bed_history(line: str) -> None: - if not os.path.exists(file_path): - add_line_to_bed_history(header) + exists = os.path.exists(file_path) with open(file_path, "a") as fp: + if not exists: + fp.write(header) fp.write(line + "\n")