Default Persistence Service

Hi There,

i try to build an Energy Counter and like to use historic data from my persistence service (mysql), but i get the error: There is no queryable persistence service registered with the name ‘rrd4j’ in the log. So in OH1 i had the option to define a service as default. where to define it in OH2.


I can’t answer your specific question, but in your sumSince and other persistence calls you can supply “mysql” as an argument to have it use MySQL rather than whatever the default is.

The default is defined as rrd4j, but you can change it by adding such a line in your conf/services/runtime.cfg.

What you need to make sure though is that the service is installed at all (add it in your addons.cfg).


Found it an added it. Now i am trying it. Hope it will fix my problem :slight_smile:


Good information.


Could you please share your knowledge. I don’t get useful information from Kais above mentioned line in conf/services/runtime.cfg.
How does the line look like, to change the default persistence service?

In PaperUI you can change it by:

PaperUI -> Configuration -> System -> Persistence (bottom of the page)

I’m not sure yet how to do it using text files.

Thanks for your hint.
I wished there was a complete docu. Every change I do in the GUI seems for me it ends in the nirvana. I’m used to configure by files (in OH1).
Is there an easy way to support the documentation. Maybe with some more experience I could help in some sections.

If you have something that is a like a tutorial just create a new posting in the Tutorials and Examples tag and follow @ThomDietrich’s excellent Influx+Grafana as a template for how to structure and present the information.

For the OH 1 docs, just dive in and edit the wiki pages.

For OH 2, post an issue to the openhab-docs github so everyone knows what you are working on, fork the repo and create a new branch for your changes. Then make the changes and issue a pull request when it is done.

to use text files edit runitme.cfg with
org.eclipse.smarthome.persistence:default=jdbc (or your preferred option)


Thanks for you instructions. OH1 wiki I know already and I’ve contributed some minor additions. For OH2 it sounds more like rocket science for an non-developer. I didn’t work with github, forks, pulls e.g.
Not so easy to contribute then.
Well, I’ll give it a try, when I have to time.

Hey @staehler67,
that’s a problem indeed but should not discourage your contribution intention! You can report ideas, corrections or complete articles via the GitHub issues system. If you later want to get more serious, I can give you a quick introduction on how to help with the docs on GitHub. You are also welcome to write tutorials or post your solution examples here in the forum under Tutorial&Examples.

Hi @rodgarcia1,

as you are obviously running jdbc successfully.
Could you please have a look here if you have an idea about my problem in that post?


Just wanted to re-open this thread rather than start a new one.

If i set the default persistence service in the PaperUI, do I need to then setup a persistence rule or file?

I come from the OH1 world and am starting fresh in OH2 since I moved from my old home with old configs from OH1. I decided a clean start would be beneficial. I know in OH1 I needed to create the persistence file that outlined the persistence strategy. Will default setup a default persistence file as well with the everyChange and restoreOnStartup options?

No, it won’t.
You will still need to create a *.persist file with your persistence strategy.