Energy charts in days/weeks/months/years


I’m planning several energy meters where Openhab would regularly acquire the latest energy values in kWh.
Is there any easy way to get some energy charts in days/weeks/months/years calculated from the energy values.
I could sum up some items, but this would be a lot of items and would get quite complex.

As an example there is a very good implementation in Home Assistant where you have on the top daily/monthly/weekly/yearly buttons to select the right chart

In Domoticz there seem to be something similar.

What would be the best way for OH3?

I think you’ll find that charting is on by default for most items in OH3.

Just hit the analyse button on an appropriate item.

You can save the view and include it in the side bar for quick access.

You can also chart in BasicUI really easily.

Both have the option to change the view.

(I only discovered this yesterday)

Just one addition: You might have a situation similar than mine, where your meter sends you total readings, but you might need incremental ones to graph consumptions properly. I know Grafana can do the transformation automatically, but since I wanted to stick to the OH graphing tool, I solved it with this.

1 Like

Can you please update the link, seems not to work. :grinning:

I also would like to stick to OH. Doing it incremental is getting quite complex, especially if you want to have the monthly consumption over several years. I think we need to have some buttons like Today, Week, Month, Year and basing on the consumption readings the charts are calculated.


Not really. The standard OH graph function allows you to do so.

This looks very good, need to give it a try. Thanks!
What persistence service are you using? rrd4j?

Maybe take a look at this one?

influxDB 1.8. Though, from what I know, this should not make a difference.

I have created items for

“this month”
“last 30 days”

Etc… Which are updated everytime the total consumption increases. It uses the persistance and rules to calculate those values.

This is actually what I’m looking for. Can you please provide more information how you made this.
I tried this, but this is different.
Pages → Create chart → Add Grid → Add Times Series → Type Bar

1 Like

Still didn’t figure out how @Cplant made these charts. :frowning:
Anybody any idea?

To create this kind of chart, you cannot use pages->create chart. Instead you need to use the built-in analyzer for the item you want to create the chart for: Go to your item‘s page (e.g. on the „Properties“ page or through developer sidebar shift-alt-d, or Settings->Items), then click „Analyze“.

This opens a chart for this item only which you can modify to display the desired data and then save as a new chart page.

To display a monthly aggregate from an increasing counter (water meter or electric energy counter) open the drawer at the bottom of the screen, select tab „coords“ and select buttons „Fixed“ and „Aggregate“.
Change to tab „Series“ and on the right side select „Aggregation->Difference of firsts“.
You can change the appearance further using the other availabe options, but this is all that‘s necessary to show „per (day/month/…) view of a counter value. The save button at the top right creates a new chart page. Yes, it‘s confusing that the „create chart“ page in the settings menu has totally different options, but it‘s great to have all the options available somewhere. If all options were in one place it would probably be even more confusing.

Hope this helps, the screenshot some posts above shows almost everything, except how to get to the screen in the first place :grinning:


Thanks for the info. This is really great.
I have following questions:

  1. Once I have created the new chart page over the item’s analyze button can I still edit them or do I need to start from scratch to modify it?
  2. Is it somehow possible to get Day, Week, Month, Year (Coords View) always visible after the chart page was created. Otherwise I need to create separate chart pages, what would decrease the usability.
  1. You can still edit the page. Note that clicking an “Analyze” on the item page again will create a new (temporary) chart only! The “save” button will create a new chart page accessible though settings->Pages (where you can attach the chart to your sidebar)
  2. The time interval cannot be changed after creation. However, you can still switch between the “current” interval (e.g. this year) and previous intervals (last year, the year before, …)

I need to correct myself: It certainly IS possible to create this kind of chart from Settings->Pages->Create Chart. Just select “Add Aggregate Series” instead of “Add Time Series” and the chart editor will show the relevant options when editing the series.
But personally I find the method to add the chart via the integrated analyzer to be easier. It is still possible to create a chart there and edit it in the Settings->Pages editor later.

  1. And how do I get into the initial “Analyze” button editor once the chart page is created? The Settings->Pages->Chart Editor / Edit Aggregate Series is different.
  2. Hmm. That’s too bad that here are no Day, Week, Month, Year buttons :frowning:

The best way to workaround the missing day, week, month, year button is to use tabbed chart pages. Create a chart for day, week, month, year and put it into a tabbed page.

What I’m actually missing now is the time range “DECADES”. “YEAR” shows the charts for months. Can I define this time range “DECADES” somehow, so that I also see the total consumption of a year. Then I can also compare several years.

Thank you for the instructions how to create the aggregated charts. I created some pages following your instructions - with one exception: for me the values are calculated correctly when using “difference of lasts” instead of “difference of firsts”. I am using a weekly summary.

The issue I have is that the chart never shows values on a Monday. Any thoughts?

The issue is described here, hopefully we get a solution from the developers.

Thanks for linking the issue. I left a comment over there.

Ok, thank you! How did you make these bubbles with 8 and 46? Do you know if there is also a way to get the total amount of the complete week shown somewhere in the chart?