Store series of values

Posted on
Sun Nov 26, 2023 9:52 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Store series of values

Hi all,

I am integrating a script which connects via ModBus to my Solar Inverter; I get every 5 mins or so a value which represents how much kW my solar is generating; the target is to display them in Grafana, but how can I store them in Indigo?
The same is for the total generated kWh every day.

I though maybe with JSON with time/value pairs; the same for the daily kWh.

Thanks
Marco

Posted on
Wed Nov 29, 2023 2:10 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Store series of values

I don't think we understand the environment: can you get it in JSON format? If not, what to you get from the Inverter? Is it getting it from a URL or something? The more specifics the better answer you're likely to get.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Dec 03, 2023 8:06 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: Store series of values

So basically I have a python script running in a schedule (for the moment) which downloads some data from my solar panel inverter.
I would like to store them somehow and then display them in a chart with Grafana.

Thanks

Posted on
Sun Dec 03, 2023 11:35 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Store series of values

You didn't answer my questions:

jay (support) wrote:
I don't think we understand the environment: can you get it in JSON format? If not, what to you get from the Inverter? Is it getting it from a URL or something? The more specifics the better answer you're likely to get.


Specifics are key to helping you.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 05, 2023 4:17 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: Store series of values

Hi Jay,

it is a simple python script which gives me a back a number, no JSON.
This python script uses a Modbus library to connect to the inverter and read the values it publishes
Therefore I need to find a way how to store this number and display then with Grafana.

Posted on
Tue Dec 05, 2023 9:33 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Store series of values

If it's just 1 number every 5 minutes you can store it to a variable and then use SQL Logger to query for your reports.

Posted on
Tue Dec 05, 2023 9:43 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Store series of values

How are you going to get it into Grafana? As @ryanbuckner you can store the value in an Indigo variable, but I don't know how to get it into Grafana after that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Dec 06, 2023 1:55 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: Store series of values

I already thought to store the value in the variable, but the variable shall contain then the whole series, not only the last one.

As far as I know, it is possible with Grafana to show variables values, need to check.

Posted on
Wed Dec 06, 2023 5:24 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Store series of values

If you want to save the whole series (data over time) then storing it in a variable would not be the best choice. I'd recommend saving the data to a file on the server machine in CSV or JSON format. I don't know anything about how to get the information into Grafana unfortunately.

Your best option in my opinion is to use a Python script attached to an Indigo schedule that reads the data from your solar array at a set interval, grabs the output value, and saves it to a data file. A couple things to think about if it were me doing it: 1) I would only run the schedule while the Indigo variable isDayLight is True, and 2) I would put some type of boundary on how much data to retain -- capturing every 15 minutes for a year is just over 35,000 data points (much less if you run it during daylight hours). Capturing it every 5 min as you suggest above would become huge very quickly.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Dec 06, 2023 6:17 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Store series of values

jay (support) wrote:
How are you going to get it into Grafana? As @ryanbuckner you can store the value in an Indigo variable, but I don't know how to get it into Grafana after that.


I had suggested using a query against the data in SQL Logger to extract the data into Grafana

Posted on
Wed Dec 06, 2023 6:18 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Store series of values

ryanbuckner wrote:
jay (support) wrote:
How are you going to get it into Grafana? As @ryanbuckner you can store the value in an Indigo variable, but I don't know how to get it into Grafana after that.


I had suggested using a query against the data in SQL Logger to extract the data into Grafana. 35,000 data points shouldn't be a problem for postgres

Posted on
Wed Dec 06, 2023 9:55 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Store series of values

Yes, SQL is also an option. I'm partial to CSV, but I know others prefer the database approach. There's nothing wrong with either. One thing I like about CSV is its universality, but it's also nice because--if you need to edit the data for some reason later on--it's easy to do with any plain text editor.

If you can get the data into an Indigo variable, the Matplotlib Plugin's CSV Engine Device makes it easy to create CSV files. #ShamelessPlug

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Dec 06, 2023 3:51 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Store series of values

I think the bottom line here is that we need to know how you are getting data into Grafana. Based on that, we can recommend more specific solutions.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Dec 08, 2023 12:16 pm
nathanw offline
Posts: 153
Joined: Sep 05, 2011
Location: Boston, MA

Re: Store series of values

Grafana needs to query some time-series database., so you need to have one of those somewhere.

I think your easiest path would be to install the Grafana Home Dashboard plugin: https://www.indigodomo.com/pluginstore/167/ and store the data in the InfluxDB instance that creates.

This is roughly what I do - I use that plugin and send to an InfluxDB instance, and use Grafana for visualization. I just host that InfluxDB instance (and the Grafana that points to it) somewhere else (a Google Cloud VM), but the idea is the same and the logging mechanism is the same.

Depending on what your script is, it might make more sense to run the script outside of Indigo; it can still post values into the InfluxDB database.

Posted on
Fri Dec 08, 2023 1:46 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Store series of values

well this looks like the answer sheet. Prob should move this to that forum

Who is online

Users browsing this forum: No registered users and 4 guests