Hello
I’m using grafana 9 and influx 2. I have the following issue. I want to calculate the WattHours (or kwh) produced per day. I record every 1 minute the current watt value from the inverters (i have a total of 2)
I can’t manage to aggregate it by day with both combined. This is the way to get the current watts for each inverter
from(bucket: "fronius")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "energy")
|> filter(fn: (r) => r["_field"] == "watt")
|> filter(fn: (r) => r["equipment"] == "inverter1" or r["equipment"] == "inverter2")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
I managed to combine the values
from(bucket: "fronius")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "energy")
|> filter(fn: (r) => r["_field"] == "watt")
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> group(columns: ["_time"])
|> sum(column: "_value")
|> group()
But form here I did not manage to create the daily production. Can anyone help me how to change this in influx2, I saw queries for influx1 but did not manage to convert them.
Goal is to show something like this
Thanks