Skip to content

Extensions

Johan Meijer edited this page Jan 27, 2022 · 5 revisions

Grott 2.4.x supports extensions to create your own data processing

With this you can add your own data processing to Grott.

At this moment there are 2 extension example available:

grotcsv.py (author @pierstitus)

CSV export extension.

One CSV file per day is saved.

Add in the grott ini:

[extension]
extension = True 
extname = grotcsv
extvar = {"outpath": "<path to your CSV files>", "csvheader": "<your csv header>"}

extvar configuration:

"outpath": path where to save CSV files, default: "/home/pi/grottlog"

"csvheader": comma separated string with fields to store, defaults to all available fields

grottext.py

This extension writes(HTTP put) the Grott data (in a JSON message) to a http server.

At this moment Grott 2.4.0 can be found in the 2.4 branche.

Short how to use:

Copy grottext.py from the github example directory into the Grott main directory (change the coding if you want).

Add in the grott ini:

[extension]
extension = True 
extname = grottext
extvar = {"ip": "<your server url>", "port": "<your server port>"}

Creating your own extension:

In the extension the following data is available:

  • Grott MQTT JSON containing all output variables that are available within Grott
    • you can print(jsonmsg) to see which variables are available
  • Growatt Raw data record. The unscrambled data record that is send by the inverter to the Growatt server
    • you can print(data) to see which variables are available
  • Grott configuration information
    • you can print(dir(conf)) to see which config variables are available
    • e.g. conf.verbose variable to indicate if verbose is enabled or not.
  • It is also possible to add your own variables to the config file. In the example:
    • extvar = {"ip": "192.168.0.206", "port": "8000"}
    • this creates 2 variables: conf.extvar["ip"] and conf.extvar["port"]
    • Be aware: It is under development and might not work as expected.

I am really curious if this is something that is going to be used. I like to see your extensions and will add them to a sample directory in the github repository.