Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created small influxdb output file #32

Open
rwrw01 opened this issue Apr 8, 2018 · 1 comment
Open

created small influxdb output file #32

rwrw01 opened this issue Apr 8, 2018 · 1 comment

Comments

@rwrw01
Copy link

rwrw01 commented Apr 8, 2018

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 )
@iepmaatje
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants