if not Configuration.SYSTEMIDS[index]=="": #Send it all off to PVOutput.org cmd = ['/usr/bin/curl', '-d', t_date, '-d', t_time, '-d', t_energy, '-d', t_power, '-d', t_volts, '-d', t_temp, '-H', 'X-Pvoutput-Apikey: ' + Configuration.APIKEY, '-H', 'X-Pvoutput-SystemId: ' + Configuration.SYSTEMIDS[index], 'http://pvoutput.org/service/r1/addstatus.jsp'] ret = subprocess.call (cmd) try: m = MysqlInserter() m.insert(Configuration.RS485IDS[index], dcVoltage, dcPower, acPower) except: print "Error inserting into mysql" except: print "No or failed response from inverter %d - shutdown? No Data sent to PVOutput.org"% (index+1) if validInv >1 and totalACPower >0: print "%d awake Inverters" % validInv avgTempDC=avgTempDC/validInv t_energy = 'v1={0}'.format(totalWh) t_power = 'v2={0}'.format(totalACPower) t_temp = 'v5={0}'.format(avgTempDC) #Send it all off to PVOutput.org cmd = ['/usr/bin/curl',
try: print "2: Efficiency: %.2f%%" % (100.0*int(acPower2)/int(dcPower2)) except: pass energyDay2 = inv2.call('Energy Day') print ("2: Energy Day: " + str(energyDay2) + " Wh\n") connection.close() try: print ("Total: AC Power: " + str(int(acPower1) + int(acPower2)) + " W") except: pass try: print ("Total DC Power: " + str(int(dcPower1) + int(dcPower2)) + " W") except: pass try: print ("Total Energy Day: " + str(int(energyDay1) + int(energyDay2)) + " Wh\n") except: pass try: m = MysqlInserter() m.insert(1, dcVoltage1, dcPower1, acPower1) m.insert(2, dcVoltage2, dcPower2, acPower2) except: print "Error inserting into mysql"