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: while 1:
# ser.readline() # ser.readline()
Data = ser.readline().decode('ascii') Data = ser.readline().decode('ascii')
print("Data: ")
print(Data) print(Data)
outFile = open(outfile, "w") if len(Data) > 0:
outFile.write(Data) outFile = open(outfile, "w")
outFile.close outFile.write(Data)
outFile.close
##while 1: ##while 1:
## # { "command": "switch", "arg": "one", "state": "off", "ver":"1690931931"} ## # { "command": "switch", "arg": "one", "state": "off", "ver":"1690931931"}