cycle with bme280

master
ademant 2019-06-30 19:39:27 +02:00
parent ca8e41c805
commit 28126b1752
1 changed files with 7 additions and 4 deletions

View File

@ -13,7 +13,7 @@ cf=open(configfile,"r")
log_conf=json.load(cf) log_conf=json.load(cf)
cf.close() cf.close()
parameter={"device":socket.gethostname(),"mean_count":5,"ring_length":10,"wait":0.5} parameter={"device":socket.gethostname(),"mean_count":5,"ring_length":10,"wait":0.5,"cycle":5}
for n in parameter: for n in parameter:
if n in log_conf: if n in log_conf:
parameter[n]=log_conf[n] parameter[n]=log_conf[n]
@ -49,9 +49,12 @@ if "bme280" in log_conf:
bme_sigma=int(log_conf['bme280']['sigma']) bme_sigma=int(log_conf['bme280']['sigma'])
if bme_sigma < 1: if bme_sigma < 1:
bme_sigma=1 bme_sigma=1
bme_temp=meas_data(var_name="temperature",ring_length=parameter['ring_length'],device=parameter['device'],sensor="BME280",i2c=bme_add,store_file="/home/pi/log/data_temperature",sigma=bme_sigma) bme_cycle=5
bme_hum=meas_data(var_name="humidity",ring_length=parameter['ring_length'],device=parameter['device'],sensor="BME280",i2c=bme_add,store_file="/home/pi/log/data_humidity",sigma=bme_sigma) if "cycle" in log_conf['bme280']:
bme_press=meas_data(var_name="pressure",ring_length=parameter['ring_length'],device=parameter['device'],sensor="BME280",i2c=bme_add,store_file="/home/pi/log/data_pressure",sigma=bme_sigma) bme_cycle=int(log_conf['bme280']['cycle'])
bme_temp=meas_data(var_name="temperature",mean_count=bme_cycle,store_each_cycle=True,ring_length=parameter['ring_length'],device=parameter['device'],sensor="BME280",i2c=bme_add,store_file="/home/pi/log/data_temperature",sigma=bme_sigma)
bme_hum=meas_data(var_name="humidity",mean_count=bme_cycle,store_each_cycle=True,ring_length=parameter['ring_length'],device=parameter['device'],sensor="BME280",i2c=bme_add,store_file="/home/pi/log/data_humidity",sigma=bme_sigma)
bme_press=meas_data(var_name="pressure",mean_count=bme_cycle,store_each_cycle=True,ring_length=parameter['ring_length'],device=parameter['device'],sensor="BME280",i2c=bme_add,store_file="/home/pi/log/data_pressure",sigma=bme_sigma)
if "sqlserver" in log_conf: if "sqlserver" in log_conf:
hostname="banana" hostname="banana"
if "host" in log_conf['sqlserver']: if "host" in log_conf['sqlserver']: