Added code to create noexisting databases
This commit is contained in:
parent
13ac853ac6
commit
db39570572
|
@ -1,11 +1,14 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
import serial
|
import serial
|
||||||
import crcmod
|
import crcmod
|
||||||
import rrdtool
|
import rrdtool
|
||||||
import paramiko
|
import paramiko
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
from config import *
|
from config import *
|
||||||
|
|
||||||
calc_crc = crcmod.predefined.mkCrcFun(CRC_TYPE)
|
calc_crc = crcmod.predefined.mkCrcFun(CRC_TYPE)
|
||||||
|
@ -147,6 +150,10 @@ def upload_graphs():
|
||||||
def main():
|
def main():
|
||||||
ser = serial.Serial(SERIAL, BAUD_RATE, timeout=60.0)
|
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:
|
while True:
|
||||||
line = ser.readline().decode('ascii')
|
line = ser.readline().decode('ascii')
|
||||||
if len(line) > 0:
|
if len(line) > 0:
|
||||||
|
|
Loading…
Reference in New Issue