bootshorn better temp logging +
This commit is contained in:
parent
6f86abd997
commit
951fa63296
2 changed files with 7 additions and 2 deletions
|
@ -32,7 +32,12 @@ print(f"@{temperature_date}: {temperature}°C")
|
||||||
|
|
||||||
filename = temperature_date.strftime("%Y-%m-%d_00-00-00.000000%z") + ".log"
|
filename = temperature_date.strftime("%Y-%m-%d_00-00-00.000000%z") + ".log"
|
||||||
logpath = os.path.join(TEMPERATURE_LOG_DIR, filename)
|
logpath = os.path.join(TEMPERATURE_LOG_DIR, filename)
|
||||||
|
now_utc = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
|
||||||
with open(logpath, "a+", newline="") as logfile:
|
with open(logpath, "a+", newline="") as logfile:
|
||||||
writer = csv.writer(logfile)
|
writer = csv.writer(logfile)
|
||||||
writer.writerow([temperature_date.strftime('%Y-%m-%d_%H-%M-%S.%f%z'), temperature])
|
writer.writerow([
|
||||||
|
now_utc.strftime('%Y-%m-%d_%H-%M-%S.%f%z'), # current UTC time
|
||||||
|
temperature_date.strftime('%Y-%m-%d_%H-%M-%S.%f%z'), # date of temperature reading
|
||||||
|
temperature,
|
||||||
|
])
|
|
@ -25,7 +25,7 @@ defaults = {
|
||||||
'systemd-timers': {
|
'systemd-timers': {
|
||||||
'bootshorn-temperature': {
|
'bootshorn-temperature': {
|
||||||
'command': '/opt/bootshorn/temperature',
|
'command': '/opt/bootshorn/temperature',
|
||||||
'when': '*:0/5',
|
'when': '*:0/10',
|
||||||
'working_dir': '/opt/bootshorn',
|
'working_dir': '/opt/bootshorn',
|
||||||
'user': 'ckn',
|
'user': 'ckn',
|
||||||
'group': 'ckn',
|
'group': 'ckn',
|
||||||
|
|
Loading…
Reference in a new issue