master
ademant 2019-06-05 05:09:54 +02:00
parent 0705262c08
commit 696effd4b6
1 changed files with 13 additions and 9 deletions

22
tri.py
View File

@ -150,7 +150,7 @@ else:
client.connect()
# declare ve mppt
bve=True
bve=False
try:
ve=vedirect('/dev/serial/by-id/usb-VictronEnergy_BV_VE_Direct_cable_VE1SSBVT-if00-port0',60)
except:
@ -240,12 +240,16 @@ while a > 1:
# read ve data
if bve:
vedata=ve.read_data_single()
ch_val[channel_names.index("volt_bat_ve")]=int(vedata['V']) # Battery voltage measured by ve
ch_val[channel_names.index("volt_arr_ve")]=int(vedata['VPV']) # Array voltage measured by ve
ch_val[channel_names.index("amp_ve")]=int(vedata['I']) # loading current by ve
ch_val[channel_names.index("watt_ve")]=int(vedata['PPV']) # Array power measured by ve
ch_val[channel_names.index("days_ve")]=int(vedata['HSDS']) # total days online ve
try:
vedata=ve.read_data_single()
except:
print("could not read VE")
else:
ch_val[channel_names.index("volt_bat_ve")]=int(vedata['V']) # Battery voltage measured by ve
ch_val[channel_names.index("volt_arr_ve")]=int(vedata['VPV']) # Array voltage measured by ve
ch_val[channel_names.index("amp_ve")]=int(vedata['I']) # loading current by ve
ch_val[channel_names.index("watt_ve")]=int(vedata['PPV']) # Array power measured by ve
ch_val[channel_names.index("days_ve")]=int(vedata['HSDS']) # total days online ve
timefile=round(timestamp/3600000)
f1=open("/home/pi/log/data_{:d}.txt".format(int(timefile)),"a")
@ -310,9 +314,9 @@ while a > 1:
# print "charge state : %.2f" % charge_state
if push_counter>=push_count:
push_counter = 1
push_counter = 1
else:
push_counter=push_counter+1
push_counter=push_counter+1
time.sleep(5)