in OH1, I’ve used both mapdb and rrd4j. mapdb just for restoreOnstartup purposes for all items and rrd4j to display the presence state of several mobile devices, which where queried with the exec binding returning ON or OFF. In the chart this was either a 0 or a 1. All mobile devices were grouped to group gChartAnwesenheit. Both persistence worked flawlessly.
I transferred this exactly to OH2, but all I get is a blank chart. No item states! I’ve checked the rrd4j persistence folder, all three items are listed there as a file and all get updated every minute. So I assume the persistence itself is running. mapdb is also running.
// for rrd charts, we need a cron strategy
everyMinute : "0 * * * * ?"
default = everyChange
// additionally persist weather info every minute
gChartAnwesenheit* : strategy = everyUpdate, everyMinute
Chart item=gChartAnwesenheit label="Anwesenheit" icon="present" period=12h
Has anyone a smart idea where to look for the error? The only thing I could imagine is the fact that the items are switch items and deliver ON/OFF. And maybe RRD4J in OH2 cannot handle this (means: can not convert this to 0/1)? And for whatever reason this worked with OH1?
I think I have the same issue, when I plot the graph using habpanel it showed 1/0 though. You might give it a try to verify if the “on” is converted to 1. I’m Still looking for the solution.
Did you configure OH 2 to use rrd4j as your default persistence? If not you need to specify which persistence service you want it to use to generate the chart.
Chart item=gChartAnwesenheit label="Anwesenheit" service="rrd4j" icon="present" period=12h
Thanks @rlkoshak! I saw this option in the documentation and already tried this some weeks ago. I did a new try today (newer snapshot) but also no luck.
My default persistence (defined via PaperUI) is mapdb.
I can’t identify your specific problem, but if your default is MapDB you must keep the service tag in there. You can’t generate charts from MapDB.
For future reference, as I found the solution myself:
There wasn’t anything wrong with the persistence service or the strategy. OH2 simply couldn’t convert the SWITCH item values (ON/OFF) to a rrd4j chart output (0/1). That’s what I already assumed. For whatever reason in OH1 the transformation was automatically done.
Solution: I adapted the presence script to get an 0/1 output (instead of ON/OFF), changed the item types from SWITCH to NUMBER and the chart came up again!
Thanks for your help. @Marijn_Oudijk: Maybe you can also use this.