Bar chart used energy past week/month

Hi guys,

I’m pretty new to Grafana and have an issue I can’t figure out. Btw, I’m using InfluxDB as data source.

I’m getting data from my smart energy meter (measuring gas/power usage) going to Home Assistant and then to InfluxDB. The interfal of sending data is when the number changes (so when not using gas the latest number stays until gas usage starts) and resets at midnight (so daily usage).

So I want 3 graphs, a daily, weekly and monthly usage. The daily graph I’ve already setup and running as a line graph. The weekly and monthly graphs I want them to be bar graphs.

So when setting up the weekly graph, I’m getting a discrepancy between daily and weekly.

So for example, today my current gas usage so far is 0.62m3 as can be seen on the daily graph below:

I know this value is correct because I can check the sensor value in Home Assistant:
status

But when I try to setup the weekly graph I get an usage of 0.364m3:
“See second post for image”

This discrepancy is for every day. I’ve tried different options and values in the graph but never get the same outcome as the daily graph.

This are the settings for the daily graph with a relative time of 24h:
SELECT mean("value") FROM "m3" WHERE ("entity_id" = 'daily_gas') AND $timeFilter GROUP BY time($__interval) fill(linear)

This are the settings for the weekly graph with a relative time of 7d:
SELECT mean("value") FROM "m3" WHERE ("entity_id" = 'daily_gas') AND $timeFilter GROUP BY time(1d) fill(linear)

The fix is propably easy but I can’t figure it out.

Cheers!

Did you ever try this:

Fadjar Tandabawana

1 Like

No I haven’t, I’ll give it a try, thanks!

Let you know the outcome.

I tried to install this but I can’t reach the plugin folder as I’m running hassio. I only can add plugins that are available on https://grafana.com/plugins which that plugin is not unfortunately.

Any other suggestions?

If you can go to /var/lib/grafana/plugins
you can use emit comamnd
git clone https://github.com/AutohomeCorp/grafana-compare-queries.git

I’m not sure how to get there as it is running in a different container. At the moment I can only SSH into HA container (sorry still a noob in this). Is there a way to SSH into different container?

1 Like