def main(): rct_lib.init(sys.argv) clientsocket = rct_lib.connect_to_server() if clientsocket is not None: socx = rct_lib.read(clientsocket, 0x959930BF) soc = int(socx * 100.0) writeRam('speichersoc', soc, '0x959930BF battery.soc') watt = int(rct_lib.read(clientsocket, 0x400F015B) * -1.0) writeRam('speicherleistung', watt, '0x400F015B g_sync.p_acc_lp') watt = int(rct_lib.read(clientsocket, 0x5570401B)) #rct_lib.dbglog("speicherikwh will be battery.stored_energy "+ str(watt)) writeRam('speicherikwh', watt, '0x5570401B battery.stored_energy') watt = int(rct_lib.read(clientsocket, 0xA9033880)) #rct_lib.dbglog("speicherekwh will be battery.used_energy "+ str(watt)) writeRam('speicherekwh', watt, '#0xA9033880 battery.used_energy') stat1 = int(rct_lib.read(clientsocket, 0x70A2AF4F)) rct_lib.dbglog("battery.bat_status " + str(stat1)) stat2 = int(rct_lib.read(clientsocket, 0x71765BD8)) rct_lib.dbglog("battery.status " + str(stat2)) stat3 = int(rct_lib.read(clientsocket, 0x0DE3D20D)) rct_lib.dbglog("battery.status2 " + str(stat3)) faultStr = '' faultState = 0 if (stat1 + stat2 + stat3) > 0: faultStr = "Battery ALARM Battery-Status nicht 0" faultState = 2 # speicher in mqtt os.system('mosquitto_pub -r -t openWB/housebattery/faultState -m "' + str(faultState) + '"') os.system('mosquitto_pub -r -t openWB/housebattery/faultStr -m "' + str(faultStr) + '"') socsoll = int(rct_lib.read(clientsocket, 0x8B9FF008) * 100.0) os.system('mosquitto_pub -r -t openWB/housebattery/soctarget -m "' + str(socsoll) + '"') rct_lib.close(clientsocket) sys.exit(0)
def main(): rct_lib.init(sys.argv) clientsocket = rct_lib.connect_to_server() if clientsocket is not None: fmt = '#0x{:08X} {:' + str( rct_lib.param_len) + '}' # {:'+str(rct_lib.desc_len)+'}:' for obj in rct_lib.id_tab: if rct_lib.search_id > 0 and obj.id != rct_lib.search_id: # rct_lib.dbglog( obj.id, obj.name) continue if rct_lib.search_name is not None and fnmatch.fnmatch( obj.name, rct_lib.search_name) is False: continue value = rct_lib.read(clientsocket, obj.id) if rct_lib.dbglog(fmt.format(obj.id, obj.name), value) is False: print(value) rct_lib.close(clientsocket)
def main(): rct_lib.init(sys.argv) clientsocket = rct_lib.connect_to_server() if clientsocket is not None: # aktuell pv1watt=int(rct_lib.read(clientsocket,0xB5317B78 )) pv2watt=int(rct_lib.read(clientsocket,0xAA9AA253 )) pv3watt=int(rct_lib.read(clientsocket,0xE96F1844 )) rct_lib.dbglog("pvwatt A:"+ str(pv1watt) + " B:"+ str(pv2watt) + " G:"+ str(pv3watt) ) writeRam('pv1wattString1', int(pv1watt), 'pv1watt') writeRam('pv1wattString2', int(pv2watt), 'pv2watt') pvwatt = ( (pv1watt+pv2watt+pv3watt) * -1 ) writeRam('pvwatt', int(pvwatt), 'negative Summe von pv1watt + pv2watt + pv3watt') #monthly mA=int(rct_lib.read(clientsocket,0x81AE960B )) # energy.e_dc_month[0] WH mB=int(rct_lib.read(clientsocket,0x7AB9B045 )) # energy.e_dc_month[1] WH mE=int(rct_lib.read(clientsocket,0x031A6110 )) # energy.e_ext_month WH monthly_pvkwhk = ( mA + mB + mE) / 1000.0 # -> KW writeRam('monthly_pvkwhk', monthly_pvkwhk, 'monthly_pvkwhk') #yearly yA=int(rct_lib.read(clientsocket,0xAF64D0FE )) # energy.e_dc_total[0] WH yB=int(rct_lib.read(clientsocket,0xBD55D796 )) # energy.e_dc_total[1] WH yE=int(rct_lib.read(clientsocket,0xA59C8428 )) # energy.e_ext_total WH yearly_pvkwhk = ( yA + yB + yE) / 1000.0 # -> KW writeRam('yearly_pvkwhk', yearly_pvkwhk, 'yearly_pvkwhk') # total pv1total=int(rct_lib.read(clientsocket,0xFC724A9E )) # energy.e_dc_total[0] pv2total=int(rct_lib.read(clientsocket,0x68EEFD3D )) # energy.e_dc_total[1] pv3total=int(rct_lib.read(clientsocket,0xA59C8428 )) # energy.e_ext_total rct_lib.dbglog("pvtotal A:"+ str(pv1total) + " B:"+ str(pv2total) + " G:"+ str(pv3total) ) pvkwh = (pv1total + pv2total + pv3total) writeRam('pvkwh', pvkwh, 'Summe von pv1total pv1total pv1total') #mqttvar["pv/CounterTillStartPvCharging"]=pvcounter #mqttvar["pv/bool70PVDynStatus"]=nurpv70dynstatus #mqttvar["pv/WhCounter"]=pvallwh #mqttvar["pv/DailyYieldKwh"]=daily_pvkwhk #mqttvar["pv/MonthlyYieldKwh"]=monthly_pvkwhk #mqttvar["pv/YearlyYieldKwh"]=yearly_pvkwhk #mqttvar["pv/1/W"]=pv1watt #mqttvar["pv/1/WhCounter"]=pvkwh #mqttvar["pv/1/DailyYieldKwh"]=daily_pvkwhk1 #mqttvar["pv/1/MonthlyYieldKwh"]=monthly_pvkwhk1 #mqttvar["pv/1/YearlyYieldKwh"]=yearly_pvkwhk1 #mqttvar["pv/2/W"]=pv2watt #mqttvar["pv/2/WhCounter"]=pv2kwh #mqttvar["pv/2/DailyYieldKwh"]=daily_pvkwhk2 #mqttvar["pv/2/MonthlyYieldKwh"]=monthly_pvkwhk2 #mqttvar["pv/2/YearlyYieldKwh"]=yearly_pvkwhk2 rct_lib.close(clientsocket) sys.exit(0)
def main(): rct_lib.init(sys.argv) clientsocket = rct_lib.connect_to_server() if clientsocket is not None: # # read all values in one connection to rct totalfeed=int(rct_lib.read(clientsocket,0x44D4C533 )*-1.0) #rct_lib.dbglog("einspeisungkwh is "+ str(totalfeed)) writeRam('einspeisungkwh', totalfeed, '0x44D4C533 energy.e_grid_feed_total') totalload=int(rct_lib.read(clientsocket,0x62FBE7DC )) #rct_lib.dbglog("bezugkwh is "+ str(totalload)) writeRam('bezugkwh', totalload, '#0x62FBE7DC energy.e_grid_load_total') value = rct_lib.read(clientsocket, 0x6002891F ) writeRam('wattbezug', int(value )*1 , '#0x6002891F g_sync.p_ac_sc_sum') volt1=int(rct_lib.read(clientsocket,0xCF053085 )) volt1=int(volt1 * 10) / 10.0 #rct_lib.dbglog("volt1 is "+ str(volt1)) writeRam('evuv1', volt1, '0xCF053085 g_sync.u_l_rms[0] ') volt2=int(rct_lib.read(clientsocket,0x54B4684E )) volt2=int(volt2 * 10) / 10.0 #rct_lib.dbglog("volt2 is "+ str(volt2)) writeRam('evuv2', volt2, '0x54B4684E g_sync.u_l_rms[1] ') volt3=int(rct_lib.read(clientsocket,0x2545E22D )) volt3=int(volt3 * 10) / 10.0 #rct_lib.dbglog("volt3 is "+ str(volt3)) writeRam('evuv3', volt3, '0x2545E22D g_sync.u_l_rms[2] ') watt=int(rct_lib.read(clientsocket,0x27BE51D9 )) writeRam('bezugw1', watt , '0x27BE51D9 als Watt g_sync.p_ac_sc[0]') ampere=int( watt / volt1 * 10.0) / 10.0 writeRam('bezuga1', ampere, '0x27BE51D9 als Ampere g_sync.p_ac_sc[0]') watt=int(rct_lib.read(clientsocket,0xF5584F90 )) writeRam('bezugw2', watt , '0xF5584F90 als Watt g_sync.p_ac_sc[1]') ampere=int( watt / volt2 * 10.0) / 10.0 writeRam('bezuga2', ampere, '0xF5584F90 als Ampere g_sync.p_ac_sc[1]') watt=int(rct_lib.read(clientsocket,0xB221BCFA )) writeRam('bezugw3', watt , '0xB221BCFA als Watt g_sync.p_ac_sc[2]') ampere=int( watt / volt3 * 10.0) / 10.0 writeRam('bezuga3', ampere, '0xF5584F90 als Ampere g_sync.p_ac_sc[2]') freq=rct_lib.read(clientsocket,0x1C4A665F ) freq=int(freq * 100) / 100.0 #rct_lib.dbglog("freq is "+ str(freq)) writeRam('evuhz', freq, '0x1C4A665F grid_pll[0].f') writeRam('llhz', freq, '0x1C4A665F grid_pll[0].f') stat1 = int(rct_lib.read(clientsocket,0x37F9D5CA )) rct_lib.dbglog("status1 "+ str(stat1)) stat2 = int(rct_lib.read(clientsocket,0x234B4736 )) rct_lib.dbglog("status2 "+ str(stat2)) stat3 = int(rct_lib.read(clientsocket,0x3B7FCD47 )) rct_lib.dbglog("status3 "+ str(stat3)) stat4 = int(rct_lib.read(clientsocket,0x7F813D73 )) rct_lib.dbglog("status4 "+ str(stat4)) faultStr='' faultState=0 if ( stat1 + stat2 + stat3 + stat4) > 0: faultStr = "ALARM EVU Status nicht 0" faultState=2 # speicher in mqtt os.system('mosquitto_pub -r -t openWB/evu/faultState -m "' + str(faultState) +'"') os.system('mosquitto_pub -r -t openWB/evu/faultStr -m "' + str(faultStr) +'"') rct_lib.close(clientsocket) sys.exit(0)
def main(): rct_lib.init(sys.argv) clientsocket = rct_lib.connect_to_server() if clientsocket is not None: print("Battery Controler " + str(rct_lib.host)) Version = rct_lib.read(clientsocket, 0x1B39A3A3) print("Hardware Version : " + str(Version)) Version = rct_lib.read(clientsocket, 0x9D785E8C) print("Software Version : " + str(Version)) Ser = rct_lib.read(clientsocket, 0x16A1F844) print("Serial Nr : " + str(Ser[74:88])) Status = rct_lib.read(clientsocket, 0x70A2AF4F) print("Status : " + str(Status)) cap = rct_lib.read(clientsocket, 0xB57B59BD) print("Max.Lade/Enlade : " + str(cap) + ' A') cyl = rct_lib.read(clientsocket, 0xC0DF2978) print("Cycles : " + str(cyl)) Eff = int(rct_lib.read(clientsocket, 0xACF7666B) * 10000) / 100.0 print("Efficency : " + str(Eff) + ' %') Soh = rct_lib.read(clientsocket, 0x381B8BF9) print("SoH : " + str(Soh)) SoC = int(rct_lib.read(clientsocket, 0x959930BF) * 10000) / 100 print("SoC : " + str(SoC) + ' %') temp = int(rct_lib.read(clientsocket, 0x55DDF7BA) * 100) / 100.0 print("Max Cell Temp. : " + str(temp) + ' Grad') ms1 = rct_lib.read(clientsocket, 0xFBF6D834) if ms1[75] > ".": print("Batt.Pack 1 : " + str(ms1[74:88])) ms2 = rct_lib.read(clientsocket, 0x99396810) if ms2[75] > ".": print("Batt.Pack 2 : " + str(ms2[74:88])) ms3 = rct_lib.read(clientsocket, 0x73489528) if ms3[75] > ".": print("Batt.Pack 3 : " + str(ms3[74:88])) ms4 = rct_lib.read(clientsocket, 0x257B7612) if ms4[75] > ".": print("Batt.Pack 4 : " + str(ms4[74:88])) ms5 = rct_lib.read(clientsocket, 0x4E699086) if ms5[75] > ".": print("Batt.Pack 5 : " + str(ms5[74:88])) ms6 = rct_lib.read(clientsocket, 0x162491E8) if ms6[75] > '.': print("Batt.Pack 6 : " + str(ms6[74:88])) Stat1 = rct_lib.read(clientsocket, 0x71765BD8) print("Batt Status 1 : " + str(Stat1)) Stat2 = rct_lib.read(clientsocket, 0x0DE3D20D) print("Batt Status 2 : " + str(Stat2)) Stor = (int(rct_lib.read(clientsocket, 0x5570401B)) / 1000.0) print("Stored Energy : " + str(Stor) + ' Kwh') Used = (int(rct_lib.read(clientsocket, 0xA9033880)) / 1000.0) print("Used Energy : " + str(Used) + ' Kwh') #0x902AFAFB battery.temperature 22.8020839691 #0x65EED11B battery.voltage 319.721984863 #0x4B51A539 battery.prog_sn 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 #0x8B9FF008 battery.soc_target 0.97000002861 #0xB84A38AB battery.soc_target_high 0.97000002861 #0xA616B022 battery.soc_target_low 0.97000002861 #0x4E04DD55 battery.soc_update_since 0.188000202179 #0xA6C4FD4A battery.stack_cycles[0] 8 #0x0CFA8BC4 battery.stack_cycles[1] 8 #0x5BA122A5 battery.stack_cycles[2] 8 #0x89B25F4B battery.stack_cycles[3] 8 #0x5A9EEFF0 battery.stack_cycles[4] 0 #0x2A30A97E battery.stack_cycles[5] 0 #0x27C39CEA battery.stack_cycles[6] 0 #0x6388556C battery.stack_software_version[0] 5185 #0xA54C4685 battery.stack_software_version[1] 5185 #0xC8BA1729 battery.stack_software_version[2] 5185 #0x086C75B0 battery.stack_software_version[3] 5185 #0xA40906BF battery.stack_software_version[4] 0 #0xEEA3F59B battery.stack_software_version[5] 0 #0x6974798A battery.stack_software_version[6] 0 rct_lib.close(clientsocket) sys.exit(0)
def main(): rct_lib.init(sys.argv) clientsocket = rct_lib.connect_to_server() if clientsocket is not None: print("Battery Controller " + str(rct_lib.host)) Version = rct_lib.read(clientsocket, 0x1B39A3A3) print("Hardware Version : " + str(Version)) Version = rct_lib.read(clientsocket, 0x9D785E8C) print("Software Version : " + str(Version)) Ser = rct_lib.read(clientsocket, 0x16A1F844) print("Serial Nr : " + str(Ser[74:88])) Status = rct_lib.read(clientsocket, 0x70A2AF4F) print("Status : " + str(Status)) cap = rct_lib.read(clientsocket, 0xB57B59BD) print("Max.Lade/Entlade : " + str(cap) + ' A') cyl = rct_lib.read(clientsocket, 0xC0DF2978) print("Cycles : " + str(cyl)) Eff = int(rct_lib.read(clientsocket, 0xACF7666B) * 10000) / 100.0 print("Efficiency : " + str(Eff) + ' %') Soh = rct_lib.read(clientsocket, 0x381B8BF9) print("SoH : " + str(Soh)) SoC = int(rct_lib.read(clientsocket, 0x959930BF) * 10000) / 100 print("SoC : " + str(SoC) + ' %') temp = int(rct_lib.read(clientsocket, 0x55DDF7BA) * 100) / 100.0 print("Max Cell Temp. : " + str(temp) + ' Grad') ms1 = rct_lib.read(clientsocket, 0xFBF6D834) if ms1[75] > ".": print("Batt.Pack 1 : " + str(ms1[74:88])) ms2 = rct_lib.read(clientsocket, 0x99396810) if ms2[75] > ".": print("Batt.Pack 2 : " + str(ms2[74:88])) ms3 = rct_lib.read(clientsocket, 0x73489528) if ms3[75] > ".": print("Batt.Pack 3 : " + str(ms3[74:88])) ms4 = rct_lib.read(clientsocket, 0x257B7612) if ms4[75] > ".": print("Batt.Pack 4 : " + str(ms4[74:88])) ms5 = rct_lib.read(clientsocket, 0x4E699086) if ms5[75] > ".": print("Batt.Pack 5 : " + str(ms5[74:88])) ms6 = rct_lib.read(clientsocket, 0x162491E8) if ms6[75] > '.': print("Batt.Pack 6 : " + str(ms6[74:88])) Stat1 = rct_lib.read(clientsocket, 0x71765BD8) print("Batt Status 1 : " + str(Stat1)) Stat2 = rct_lib.read(clientsocket, 0x0DE3D20D) print("Batt Status 2 : " + str(Stat2)) Stor = (int(rct_lib.read(clientsocket, 0x5570401B)) / 1000.0) print("Stored Energy : " + str(Stor) + ' Kwh') Used = (int(rct_lib.read(clientsocket, 0xA9033880)) / 1000.0) print("Used Energy : " + str(Used) + ' Kwh') rct_lib.close(clientsocket)