change log

master
ademant 2019-07-03 19:03:29 +02:00
parent dd8e2a5a9a
commit 20a5f67e96
4 changed files with 7 additions and 6 deletions

View File

@ -96,7 +96,7 @@ if "ads1x15" in log_conf:
channel_names.append(cnadc)
channel_info[cnadc]={"meas_data": meas_data(var_name=cnadc,multiplicator=1,mean_count=parameter['cycle'],store_each_cycle=True,ring_length=parameter['ring_length'],device=parameter['device'],sensor="ads"+str(adc_type),i2c=adc_address,store_file="/home/pi/log/data_ads",sigma=tsl_sigma)}
if bmqtt and ("mqtt" in log_conf['ads1x15']):
channel_info[cnadc]['meas_data'].set_mqtt(host=mbroker,port=mport)
channel_info[cnadc]['meas_data'].set_mqtt(broker=mbroker,port=mport)
if "sqlserver" in log_conf:
channel_info[cnadc]['meas_data'].set_sql(host=hostname,port=port)
adc_count=adc_count+1

View File

@ -2,18 +2,19 @@ import time
from datetime import datetime
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM) # use RaspPi board layout pin numbering
GPIO.setup(0, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setmode(GPIO.BOARD) # use RaspPi board layout pin numbering
GPIO.setup(32, GPIO.IN, pull_up_down=GPIO.PUD_UP)
counter = 0
def tube_impulse_callback(channel): # threaded callback -- falling edge detected
global counter # make counter global to be able to increment it
counter+=1
print "ping"
# when a falling edge is detected on port 12, regardless of whatever
# else is happening in the program, the tube_impulse_callback will be run
GPIO.add_event_detect(0, GPIO.FALLING, callback=tube_impulse_callback)
GPIO.add_event_detect(32, GPIO.FALLING, callback=tube_impulse_callback)
try:
while True:

View File

@ -75,7 +75,7 @@ if "tristar" in log_conf:
for i in ["volt_scale","amp_scale","volt_bat_term","volt_bat_sens","volt_arr","amp_bat","amp_arr","temp_heatsink","temp_bat","ah_res","ah_tot","kwh_res","kwh_tot","watt_in","watt_out","hour_tot","state","volt_sweep_mp","volt_sweep_oc"]:
channel_info[i]={"meas_data": meas_data(var_name=i,multiplicator=1,mean_count=parameter['cycle'],store_each_cycle=True,ring_length=parameter['ring_length'],device=parameter['device'],sensor="tristar",i2c=0,store_file="/home/pi/log/data_ve",sigma=tsl_sigma)}
if bmqtt and ("mqtt" in log_conf['ads1x15']):
channel_info[i]['meas_data'].set_mqtt(host=mbroker,port=mport)
channel_info[i]['meas_data'].set_mqtt(broker=mbroker,port=mport)
if "sqlserver" in log_conf:
channel_info[i]['meas_data'].set_sql(host=hostname,port=port)

View File

@ -39,7 +39,7 @@ while True:
print("{}: could not connect to database".format(time.time()))
else:
try:
s.connect(("banana", 24049))
s.connect(("banana", 24048))
except:
print("{}: could not connect to database".format(time.time()))
else: