Fixed file create logic
This commit is contained in:
parent
1819c9db9e
commit
9a9d40db82
1 changed files with 4 additions and 3 deletions
|
@ -8,7 +8,7 @@ import requests as r
|
||||||
from ..hue import hue
|
from ..hue import hue
|
||||||
|
|
||||||
file_path: str = "bettwaage.csv"
|
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"
|
bett_ip: str = "http://192.168.178.110:80"
|
||||||
matrix_clock_api: str = "http://192.168.178.84:8000"
|
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:
|
def add_line_to_bed_history(line: str) -> None:
|
||||||
if not os.path.exists(file_path):
|
exists = os.path.exists(file_path)
|
||||||
add_line_to_bed_history(header)
|
|
||||||
with open(file_path, "a") as fp:
|
with open(file_path, "a") as fp:
|
||||||
|
if not exists:
|
||||||
|
fp.write(header)
|
||||||
fp.write(line + "\n")
|
fp.write(line + "\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue