Hello,
I have two sources of data in Influxdb. One for measuring my power consumption and another measuring my PV. With Flux; i’m able to query both sources, concatenate them and compute the daily difference. This gives me the amount of electricity sent to the grid or consumed from the grid. The problem is that i cannot graph this result. I do have points on the graphical interface but no line.
Here is the query in Flux:
Conso=from(bucket: "jeedom2/autogen")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Consommation Totale O" or r["_measurement"] == "Consommation Totale 1")
|> filter(fn: (r) => r["_field"] == "Shelly 3EM")
|> aggregateWindow(every: 1h, fn: max, createEmpty: false)
|> difference()
|> group()
|> filter(fn: (r) => r["_value"] > 0)
|> aggregateWindow(every: 1d, fn: sum, createEmpty: false)
|> set(key: "_tag", value: "Conso")
|> yield(name: "Conso")
Pv=from(bucket: "pv/autogen")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "2120198970" or r["_measurement"] == "2120199320" or r["_measurement"] == "2120199323")
|> filter(fn: (r) => r["_field"] == "energy")
|> aggregateWindow(every: 1h, fn: max, createEmpty: false)
|> difference(nonNegative: true)
|> group()
|> aggregateWindow(every: 1d, fn: sum, createEmpty: false)
|> set(key: "_tag", value: "Pv")
|> yield(name: "Pv")
//difference(nonNegative: true)
union(tables: [Pv, Conso])
|> group()
//|> sort(columns: ["_time"], desc: false)
|> window(every: 1d)
|> sort(columns: ["_tag"], desc: false)
|> difference()
//|> group()
My questions are:
I would like to graph only the result of the union.
I would like to hide the two first queries “Pv” and “Conso”.
Thanks for your support