Hi,
I want to power measure my electric stove and so I have installed three shellies sending the measurement for every phase. I can select them using:
SELECT last(“ENERGY_Power”) FROM “mqtt_consumer” WHERE “topic” = ‘oben/kueche/herd/phase1/SENSOR’
SELECT last(“ENERGY_Power”) FROM “mqtt_consumer” WHERE “topic” = ‘oben/kueche/herd/phase2/SENSOR’
SELECT last(“ENERGY_Power”) FROM “mqtt_consumer” WHERE “topic” = ‘oben/kueche/herd/phase3/SENSOR’
What I want to see in grafana is a cummulated entry showing the “ENERGY_Power” summary of all three phases.
I have tried:
SELECT sum(“last”) from (SELECT last(“ENERGY_Power”) FROM “mqtt_consumer” WHERE “topic” = ‘oben/kueche/herd/phase1/SENSOR’ OR “topic” = ‘oben/kueche/herd/phase2/SENSOR’ OR “topic” = ‘oben/kueche/herd/phase3/SENSOR’) GROUP BY time(1m) fill(null)
in grafana itself but that does not show history data of the sum.
So I have some questions:
- What am I doing wrong in this query?
- Is it the right way, to build the sum in grafana or would it be a better way to do the calculation in influxdb and put the cummulated value into an own field on every insert of phase1/2/3? And If so - I unfurtunately have no idea how to.
Thank you!
Kind regards,
Jan