t=getFromInflux(temperatureSink,"select last("+tColumnName+") from "+temperatureSink["measurement"])
dp=getFromInflux(dewpointSink,"select last(\""+dpColumnName+"\") from "+dewpointSink["measurement"])
ift==[]ordp==[]:
print("[ error ][ps] couldn't find T or DP data in influxDB. The retrieved values are")
print("[ info ][ps] T = {} DP = {}".format(t,dp))
print("[ qstn ][ps] turn off the PS anyway?")
ans=input ("y/n: ")
ifans=='y':
ps.turnOff()
print("[ info ][ps] ps off")
return
else:
print("[ info ][ps] ok!")
return
t=t[0][0]["last"]
dp=dp[0][0]["last"]
print("[ info ][ps] T = {:.2f}; dp = {:.2f}".format(t,dp))
diff=t-dp
ifdiff<maxDiffBetweenTandDPtoTurnTheHVoff:
print("[ warn ][ps] (T - DP) = {:.2f}, which is smaller than {}. Cannot power off the PS in these conditions".format(diff,maxDiffBetweenTandDPtoTurnTheHVoff))
else:
ps.turnOff()
print("[ info ][ps] ps off")
ps.turnOff()
return0
return
# if (args.force):
# ps.turnOff()
# print("[ info ][ps] ps off")
# return
#
#
# t = getFromInflux(temperatureSink, "select last(" + tColumnName + ") from " + temperatureSink["measurement"])
# print("[ error ][ps] couldn't find T or DP data in influxDB. The retrieved values are")
# print("[ info ][ps] T = {} DP = {}".format(t, dp))
# print("[ qstn ][ps] turn off the PS anyway?")
#
# ans = input ("y/n: ")
# if ans == 'y':
# ps.turnOff()
# print("[ info ][ps] ps off")
# return
# else:
# print("[ info ][ps] ok!")
# return
#
#
#
# t = t[0][0]["last"]
# dp = dp[0][0]["last"]
#
# print("[ info ][ps] T = {:.2f}; dp = {:.2f}".format(t, dp))
#
# diff = t - dp
# if diff < maxDiffBetweenTandDPtoTurnTheHVoff:
# print("[ warn ][ps] (T - DP) = {:.2f}, which is smaller than {}. Cannot power off the PS in these conditions".format(diff, maxDiffBetweenTandDPtoTurnTheHVoff))
# else:
# ps.turnOff()
# print("[ info ][ps] ps off")
#
# return
defmeasure(hw,ps,args):
# Takes data and pushes it to influxdb
...
...
@@ -356,16 +362,19 @@ if __name__ == "__main__":
sys.path.append(lrLibPath)
try:
import_labRemoteaslabRemote
importlabRemote
except:
print("Couldn't find the labRemote Python libraries. Make sure to add them to your $PYTHONPATH first by either doing")