Пример #1
0
except:
  print ("Unable to open file: ", InFileName)     

try:
  InTemp = float(MyFile.readline())
  MyFile.close()
except:
  MyFile.close()

# Print all temperature values, debug purpose...
  #print("Pre-  %s     %s    %+4.2f" % (now, "OutTemp", OutTemp))
  #print("Pre-  %s     %s    %+4.2f" % (now, "InTemp", InTemp))
if OutTemp != -99: 
#    print("  %s     %s    %+4.1f" % (now, "OutTemp", OutTemp))
  try:
    client.store({"OutTemp": OutTemp}) # Store value in Byteport
  except:
    print("Failed storing in Byteport:")
else:
  print("No reading   %s     %s    %+4.1f" % (now, "OutTemp", OutTemp))

if InTemp != -99: 
#    print("  %s     %s    %+4.1f" % (now, "InTemp ", InTemp))
  try:
    client.store({"InTemp": InTemp}) # Store value in Byteport
  except:
    print("Failed storing in Byteport:")
else:
  print("No reading   %s     %s    %+4.1f" % (now, "InTemp ", InTemp))

# Add the reading to the database	
Пример #2
0
except:
    print("Unable to open file: ", InFileName)

try:
    InTemp = float(MyFile.readline())
    MyFile.close()
except:
    MyFile.close()

# Print all temperature values, debug purpose...
#print("Pre-  %s     %s    %+4.2f" % (now, "OutTemp", OutTemp))
#print("Pre-  %s     %s    %+4.2f" % (now, "InTemp", InTemp))
if OutTemp != -99:
    #    print("  %s     %s    %+4.1f" % (now, "OutTemp", OutTemp))
    try:
        client.store({"OutTemp": OutTemp})  # Store value in Byteport
    except:
        print("Failed storing in Byteport:")
else:
    print("No reading   %s     %s    %+4.1f" % (now, "OutTemp", OutTemp))

if InTemp != -99:
    #    print("  %s     %s    %+4.1f" % (now, "InTemp ", InTemp))
    try:
        client.store({"InTemp": InTemp})  # Store value in Byteport
    except:
        print("Failed storing in Byteport:")
else:
    print("No reading   %s     %s    %+4.1f" % (now, "InTemp ", InTemp))

# Add the reading to the database