Open rwrw01 opened 6 years ago
for those who want to use is hereby a small influxdb (json) output script
import PluginLoader import os from influxdb import client as influxdb #enter ip-address of database, port and databasename db = influxdb.InfluxDBClient("192.168.2.30", 8086, "", "", "databasename") class ConsoleOutput(PluginLoader.Plugin): """Outputs the data from the Omnik inverter to stdout""" def process_message(self, msg): """Output the information from the inverter to stdout. Args: msg (InverterMsg.InverterMsg): Message to process """ json_body = [ { "measurement": "zuidpanelen", "fields": { "ID": (msg.id), "Temp": (msg.temperature), "H_Total": (msg.h_total), "E_Today": (msg.e_today), "E_Total": (msg.e_total), "VPV1": (msg.v_pv(1)), "VPV2": (msg.v_pv(2)), "VPV3": (msg.v_pv(3)), "IPV1": (msg.i_pv(1)), "IPV2": (msg.i_pv(2)), "IPV3": (msg.i_pv(3)), "L1_pac": (msg.p_ac(1)), "L1_vac": (msg.v_ac(1)), "L1_iac": (msg.i_ac(1)), "L1_fac": (msg.f_ac(1)), "L2_pac": (msg.p_ac(2)), "L2_vac": (msg.v_ac(2)), "L2_iac": (msg.i_ac(2)), "L2_fac": (msg.f_ac(2)), "L3_pac": (msg.p_ac(3)), "L3_vac": (msg.v_ac(3)), "L3_iac": (msg.i_ac(3)), "L3_fac": (msg.f_ac(3)), } } ] #uncomment row bellow for troubleshooting #print json_body db.write_points(json_body )
Hi @rwrw01, I would like to use your script to write to Influxdb. I have absolutely no idea how to realize that with the script above. You you guide me in pointing me to the correct directions ?
for those who want to use is hereby a small influxdb (json) output script