adopt log cpu temp

master
ademant 2019-06-24 15:57:54 +02:00
parent 66a5fa6f29
commit 777674c710
2 changed files with 12 additions and 7 deletions

View File

@ -21,13 +21,20 @@ if "mean_count" in log_conf:
mean_count=int(log_conf['mean_count'])
cpu_meas=meas_data(var_name="temperature",ring_length=60,device=devicename,sensor="CPU",store_file="/home/pi/log/data_cpu")
cpu_meas.set_sql(host="banana",port=24049)
if "sqlserver" in log_conf:
hostname="banana"
if "host" in log_conf['sqlserver']:
hostname=log_conf['sqlserver']['host']
port=24049
if "port" in log_conf['sqlserver']:
port=int(log_conf['sqlserver']['port'])
cpu_meas.set_sql(host=hostname,port=port)
a = 2
while True:
for n in range(mean_count):
# get cpu temperature
cpu_meas.append(int(open('/sys/class/thermal/thermal_zone0/temp').read()))
@ -35,8 +42,6 @@ while True:
# close the client
client.close()
f1.close()
print("done")

View File

@ -107,6 +107,6 @@ class meas_data:
test=meas_data("temp",5)
test.set_sql("localhost")
test.set_file_log("/home/ademant/data")
#test=meas_data("temp",5)
#test.set_sql("localhost")
#test.set_file_log("/home/ademant/data")