ignore empty inputs from serial (idk why this happens)

This commit is contained in:
Marcus 2023-08-13 04:11:45 +02:00
parent 54509b0c12
commit ea55ec786f

View file

@ -16,10 +16,12 @@ outfile = "epever-tracer.json"
while 1:
# ser.readline()
Data = ser.readline().decode('ascii')
print("Data: ")
print(Data)
outFile = open(outfile, "w")
outFile.write(Data)
outFile.close
if len(Data) > 0:
outFile = open(outfile, "w")
outFile.write(Data)
outFile.close
##while 1:
## # { "command": "switch", "arg": "one", "state": "off", "ver":"1690931931"}