openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

[enhancement] use the persistence service configured in the item (not only the standard service)

Open Gifford47 opened this issue 3 years ago • 3 comments

If I do not use the default persistence service for an item, I have to specify the persistence service in rules or diagrams every time I want to retrieve older values. It would be very handy if OH would select this automatically depending on whether OH finds the item first in the standard persistence service or not.

Gifford47 avatar Oct 06 '22 10:10 Gifford47

I'm not sure that this use case would be all that common. Most users will just have the one persistence service, usually rrd4j as that's what is configured by default and it does the job fairly well. Of those who remain, the majority who are using multiple persistence engines are doing so where one is used for restoreOnStartup and another is used for charting/access in rules.

In that case, the Item will appear in both databases. Which one should OH automatically choose? Even if we add logic to ignore MapDB in this case and rrd4j in that case we are still left with the problem that if the Item is stored in multiple databases that are capable of charting, which one does OH choose?

rkoshak avatar Oct 06 '22 13:10 rkoshak

This will probably improve once the persistence registry PR is merged and persistence services can be configured via UI.

J-N-K avatar Oct 06 '22 19:10 J-N-K

But does the PR also handle the automatic selection of the item's persistent service?

Gifford47 avatar Oct 09 '22 21:10 Gifford47

Automatic selection of an arbitrary persistence service is not possible. You can configure different persistence services for the same item. E.g. RRD4J for long-time storage and MapDB for restoreOnStartup. This may make sense because RRD4J is not loss-less, but very good for storing many values where the exact value is not so important (e.g. temperatures).

J-N-K avatar Nov 06 '22 11:11 J-N-K

I'm closing this as the way it is now is a fundamental design decision.

J-N-K avatar Nov 06 '22 17:11 J-N-K