Hello
I have a counter which is storing total energy used (shelly device).
Now I want to visualize this - but group by date.
So the counter is showing 275kwh today, and increasing each minute up to 285kWh.
So I want to show - today - 10kWh (yesterday 9kWh)…
How is it possible?
Thanks
grant2
2
Hi @DominikReber
What is your datasource and can you share the query you have created for displaying the total energy used over a given time period?
SELECT “value” FROM “TotalActiveEnergy” WHERE $timeFilter
influxdb
grant2
4
I presume that you are using InfluxQL (not SQL, which is only avaialble in InfluxDB Cloud / 3.0).
I think the spread function should work because you have an ever increasing value and add a GROUP BY time() clause.
Overall query should resemble this:
SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>),[tag_key] [fill(<fill_option>)]
Here is a potentially helpful thread: Daily consumption for one day is showing one day after
Thanks, this was the answer:
SELECT difference(distinct("value")) FROM "TotalActiveEnergy" WHERE $timeFilter GROUP BY time(1d, -1m)
tz('Europe/Berlin')