Small graph glitches in OH3

I noticed some small problems in the graphs in OH3, thought I could bring them up here.

Pasting an image of my lightsensor for the last 24 hours:

(Yes, it’s really depressingly dark up in Scandinavia currently)


  1. The last readings always seem to be missing from the graph. When taking this image I had got at least four additional readings (I double checked the persistence database). Why don’t I see them in the graph?
  2. It was completely dark here from yesterday 14:40 till today 08:50 (Between those points in time nothing was saved in the database since the level didn’t change). Looking at the graph though you get the feeling that during those points the light level is slowly rising during the night, which kinda gives the wrong impression. Is this anything that could be done anything about? Or is it a question about me needing to persist values not only when changing but also periodically?

I solved this by modifying the persistence config. On my installation i changed the default strategy to every change and every 5 minutes to have nice graphs.

Yep, that makes sense (at least for my point 2 above). However, I currently have no persistence config at all, looks like OH3 automatically persists on every change? What’s the correct way to change that?

Yes OH3 has a default persistende service rrd4j that is already installed. You can use this or switch to another one if needed. The settings for the persitence service must be done in the openhab folder. There is no possibility to modify this settings in the ui for now.

Have a look at this documentation for more details.

Maybe one addition to this. You should rethink the rrdj4 persistence if you want to have graphs for e.g. datetime items. The rrdj4 persistende can only persist numbers. No dates or strings so far i know. Therefore a lot or person use influx or jdbc as persistence service. I for example prefere jdbc with mariadb.

That’s why it is drawn like this. There was nothing in the database for the night and I assume that the first data saved in the morning was not 0, but some slightly bigger value (maybe around 1,5-2 if I can see that correctly on the graph). So the visualizer drawn a straight line between the last point in the night and the first point in the morning. That’s why it is not completely flat.

That’s strange, for me (after upgrading from OH2) there was no persistence installed at all. However, after installing jdbc-mysql and setting up the database it immediately started to write to the database without any settings at all in the persistence folder. So I thought this was normal behavior for OH3.

However, I DO have a file named jdbc.persist.bak in the persistence folder (a trace from me playing with persistence in OH2 some time ago) which says the default strategy is everyChange. I thought it would read a file with that ending, but maybe it does?

You need to rename it. Remove the .bak from the name so that oh3 can read it.

Here as an example my persistence settings for jdbc. As mentioned i use everyChange and every15Minutes for all items.

Strategies {
	// if no strategy is specified for an item entry below, the default list will be used
	everyMinute	: "0 * * * * ?"
	every5Minutes : "0 */5 * * * ?"
	every15Minutes : "0 */15 * * * ?"
   	everyHour   : "0 0 * * * ?"
   	everyDay    : "0 0 0 * * ?"
   	default = everyChange

 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).

Items {
    // persist all items once a day and on every change and restore them from the db at startup
    * : strategy = everyChange, everyDay, every15Minutes
	Group_RestoreOnStartup* : strategy = everyChange, restoreOnStartup


Yes, I understand that it needs to have the correct file ending. What I wrote was that it seems to me that either OH3 has a default strategy of persisting on every change or it did read the file even though it has the wrong file ending. Not really clear on which.

I think oh3 has some default settings but i‘m not sure. But at the moment you use the right file name extension, the settings from the file will be used and not the default one

1 Like

Just for the record (so this doesn’t drown in the discussion about persistence): This problem still remains. The last few data points are never showed in the graph for me. I don’t know if I’m alone with this problem?

You are not alone. this behavior is the same for me. The last 1 1/2 hours are not visible in the graphs

1 Like

Which database are these saved to?

Because you upgraded it used your list of already installed add-ons I suspect. If you do a default installation and then manually configure you will find the rrd4j gets installed by default.

One thing to note, because of the way that rrd4j works, you will automatically get a value saved every minute whether or not it’s updating or changing. That’s required by the database. If you use some other database server, any charting software will require you to save a value periodically in order to continue the chart level over long periods of time like shown above.

I suspect (but don’t know for sure) that by default if there isn’t a .persist file to tell it otherwise, it will persist all files on everyChange by default. If you want a different strategy you’ll need to create a .persist file.

Though that actually doesn’t make full sense. rrd4j is the default persistence that comes with OH 3 and an everyChange strategy, by itself, won’t work. You need an everyMinute strategy as well or else the database doesn’t work properly.

To a mysql database, using jdbc-mysql. Do you see all values up to the current time?

Yes, but:

  1. I’m mostly generating charts on demand using the Analyze and Analyze All buttons
  2. I’m using rrd4j for my persistence.

Yep, but that confirms it’s not a globally general problem with the charts, good to know… Maybe it’s time to file a ticket…

1 Like
1 Like