Hi,
with OH1 i just used rrd4j as persistence. Nearly all worked out of the box. Used it for “EveryChange”, “EveryMinute” (for charts) and “restoreOnStartup”.
With OH2 this works ok for all kind of Number-Items but either anymore for Switches. OH1 stored switches as on=100 and off=0, thats seemed to be changed. So charts from switches are no more possible. Also restoreOnStartup can’t work for non-number-items.
My solution for charts from switch-items is to use another rule, where an fake-number-item writes the 0 or 100 if the switch change status. Kind of uncool. More rules, more items … unnecessary.
So am i right i need a second persistence service?!
What’s “standard” out there? Using more services … only one service for everything?! I need charts from number and switch items, also restoreOnStartup vor any kind of item.
I can’t answer what the standard is as I don’t think there is one. I also don’t use OH 2 so can’t comment on any changes. But if OH 2 no longer saves the state of switches as numbers that would be a problem and I have no suggestions beyond what you have already done.
I always recommend using two or three persistence setups.
MapDB for restoreOnStartup. It can handle all Item types and since it only saves the most recent value it never grows.
rrd4j for numerical data for which you only care about relatively recent data for historical queries and charting. Like MapDB it never grows but it does stuff to old data and can only save numerical data.
an external DB (e.g. MySQL, InfluxDB, etc.) for Items you want to study and have exactly accurate data for long periods of time. For this case, db4o may be a good case to save the Switches but that won’t help with the charting. You can’t chart non-numerical data.
To assign Items to these different strategies I use Groups.
So i’ll better stay with rrd4j as it is. Because thats accurate enough for my needs. Using my fake-number-item-workaround for the switch-charts (for now).
For restoreOnStartup i’ll completing that with mapDB only logging switches and string items… Splitting that: Numbers > rrd4j, anything else > mapDB. Sounds good?
Group grrd4j (member are all number-items)
grrd4j* - means that every member in that group get logged right? Should… Like it does with Charts right know :D.
If rrd4j is still configured as the default in openhab.cfg (or where ever that is defined in OH 2) you do not need to specify the rrd4j. If you changed the default o mapdb then you do.
Don’t know where to configure that … Good advice
I’ll find something about that.
Having the same number item in rrd4j group and also in a charts group (both logged by rrd4j) don’t produce any conflict right? Because sorting out whats already in a chart group but not in rrd4j group will get really confusing.
I don’t know but I suspect the answer is no. Having it in multiple groups shouldn’t matter. It will just applyand additional strategies listed for that group.
Hi,
rrd4j and mapDB with this “group setup” working fine the last 3 days. Splitting the Number items and the “others” (DateTime, Switch, String …) to one of both persistence services works perfectly. Reboots feeling much cleaner right now. UI is always in perfect state since all items get there status back (restorOnStartup). No more missing switches or rules that stuck because of missing states.
The only thing still missing is that switches-as-chart-thing. Unbelievable that this isn’t working out of the box.
Well, you can’t use it as long as it isn’t fully implemented and merged… But maybe you can comment on the issue and tell @chris that there is interest in getting this working ( so far, nobody really asked for it, thus it had a very low prio).