Added code to create noexisting databases

This commit is contained in:
Sebastian 2018-11-07 19:18:01 +01:00
parent 13ac853ac6
commit db39570572
1 changed files with 7 additions and 0 deletions

View File

@ -1,11 +1,14 @@
#!/usr/bin/env python3
import sys
import os
import time
import serial
import crcmod
import rrdtool
import paramiko
from time import sleep
from config import *
calc_crc = crcmod.predefined.mkCrcFun(CRC_TYPE)
@ -147,6 +150,10 @@ def upload_graphs():
def main():
ser = serial.Serial(SERIAL, BAUD_RATE, timeout=60.0)
if not os.path.exists(DATA_FILE) or not os.path.exists(ARCHIVE_DATA_FILE):
create_database()
sleep(60)
while True:
line = ser.readline().decode('ascii')
if len(line) > 0: