[SOLVED] Exclude Items in persistence service


Im new here and started setting up openHAB2 yesterday. I want that every item gets inserted into a persistend database (mariadb). I was able to set it up and get it running. Now I have one value which will change pretty often. So I want to exclude this item, but I don’t know how or if it is even possible. My first thought was to add one line in the items list before the default one and it will stop after this. But it didnt work.

Below is my .persist file. The OnlyEveryHour item should be logged only every hour into the database.

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
        // if no strategy is specified for an item entry below, the default list will be used
        everyMinute     : "0 * * * * ?"
        every5Minutes : "0 */5 * * * ?"
        everyHour   : "0 0 * * * ?"
        everyDay    : "0 0 0 * * ?"
        default = everyChange

 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).

Items {
OnlyEveryHour : strategy = everyHour
  * : strategy = everyChange, restoreOnStartup

Hope anyone can help me.
Thanks in advanced.

Items {
OnlyEveryHour : strategy = everyHour
  * : strategy = everyChange, restoreOnStartup

Using the * for items will include all items. Try listing only the items you want persisted.

Thanks for the answer H102.
I know that the * includes all items. I want to include all items except one.
So is there no way to exclude items instead of include them by name?
Or don’t proced further with the next line if it allready executed fot the item?

Not that I’m aware of. How many items do you have?

Not that much, mybe 10 at the moment. I’m currently only trying to set everything up and figuring out how everything works and can be used. It would be easy to add all names to the file and remove the * from there. But then I have to change the file every time I add an item.
Is there a better way to do this without having to add every item into the .persist file?

What are you using to create and edit your files?

At the moment a normal text editor (nano from linux).
Why dose it matter with what I edit the files?

Using VSCode with the OH addon makes editing files much easier. You can copy and paste all your items (names) over to .persist file easily. Using VSCode also has other benefits worth checking out.

Put the items in a group and persist the group:

<groupName>* - all members of this group will be persisted, but not the group itself. If no strategies are provided, the default strategies that are declared in the first section are applied. Optionally, an alias may be provided if the persistence service requires special names (e.g. a table to be used in a database, a feed id for an IoT service, etc.)

1 Like


I wil think about using VSCode. Thanks for the info that there is a plugin for it. At the moment I only logon via ssh and use the console to edit everything. I don’t want to install a desktop enviroment on my linux maschine. So I would ned to install it on my local maschine and edit the files over an file share.

Thanks sihui for the info abut gruops. I first have to check how to work wirh them.

EDIT: Working with groups is amazing. When everything is set up in the .persist file you just have to add the group you want to the item and it will be saved accordingly. For me I have created a group for onChange, every 15 Min, every hour, every day. After that I only add those groups thougt paper UI to the items.
Thanks again for the tipp :+1:

1 Like