openhab-core
openhab-core copied to clipboard
[enhancement] use the persistence service configured in the item (not only the standard service)
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.
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?
This will probably improve once the persistence registry PR is merged and persistence services can be configured via UI.
But does the PR also handle the automatic selection of the item's persistent service?
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).
I'm closing this as the way it is now is a fundamental design decision.