HOW TO start with a good DATABASE to visualise energy/solar use?

I need some guidance to set up my Influx database to get the best use of the data in Grafana.
Spent already many days/hours browsing here and with google but I’m not getting any further.

setup:
“Youless” device to capture energy and solar production data
This data is processed in Node-Red and send to InfluxDB 1.8.10

I do have working panels in Grafana but I now need to go further by doing calculations and that’s when my setup grinds to a halt.

What i want to achieve is doing calculations with data to get this:

I think I did configure the InfluxDB in a wrong way:

via node-red I send data to Influx:

DATABASE NAME: sensors
MEASUREMENTS:

  • grid-time
  • grid-counter
  • grid-current_use
  • solar-time
  • solar-counter
  • solar-current-production

but now I can’t do calculations like in this example I found

SELECT 
sum("P_Red")/60 AS "Red", 
sum("P_FV")/60 AS "FV", 
sum("P_Exp")/60 AS "Exportada", 
sum("P_Cargas")/60 AS "Cargas" 
FROM "Potencias" 
WHERE ("Tipo" = '1m') 
AND $timeFilter 
GROUP BY time(1h) fill(null)

in my setup ‘FROM’ is one measurement, not a collection of several measurements

I need to do a lot of learning but I need to start with the right setup so please help me a step along… Thanks!

First of all, familiarize yourself with tags and fields. This video is 5+ years old, but the concepts are all still relevant.

Second, install the latest versions of Node-RED (incl. the Influx node configured as 2.0), InfluxDB, and Grafana.

Third, write out all your measurements, field names, tag names, data storage strategy, etc. Send everything to a temporary bucket that you can delete later.

In the temporary bucket, create your Flux queries in Influx Data Explorer. Learn how to do sums, aggregate windows, etc. Get the data there to work out exactly as you want.

Then copy the working Flux query into Grafana and see how it appears.

Basically, try to work out everything BEFORE you view it in Grafana. Flux is very powerful and you can likely do everything there that you want. Grafana will be the pretty visualization and alerting tool.

2 Likes

Thank you very much for your guidance, very useful to get me on the right path.

I just installed Influx 2.5.1 on my synology NAS, a Node-Red update is the next step and I will follow the steps you mentioned.