Few string Items not persisting

I’m not that familiar with persistence even though I have tried to read some documentation (r.g. rrd4j - Persistence Services | openHAB). I just don’t understand the documentation.

In system settings RRD4j service is enabled. All my Items do persist after restarting OH (v. 3.2) except two string Items.

I tried to create a rrd4j.persist file in the persistence directory:

// persistence strategies have a name and definition and are referred to in the "Items" section
Strategies {
        everyMin  : "0 * * * * ?"
	everyHour : "0 0 * * * ?"
        everyDay  : "0 0 0 * * ?"

        // if no strategy is specified for an Item entry below, the default list will be used
       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 {
        // persist the Item state of Heating_Mode and Notifications_Active on every change and restore them from the db at startup
        Heating_Mode, Notifications_Active: strategy = everyChange, restoreOnStartup
	PostiZDT : strategy = everyChange, restoreOnStartup
	IV2_mode_A_M : strategy = everyChange, restoreOnStartup

        // additionally, persist all temperature and weather values every hour
        Temperature*, Weather* : strategy = everyHour

I added 2 string Items PostiZDT and IV2_mode_A_M into the persist file. I restarted OH again and noticed that none of my Items persisted after restart. I then changed the name of the persist file to something else and restarted OH again. Now the Items persisted except these 2 string Items.

So, where are the persistence strategies saved? Only file I originally had in the persistence folder was readme.txt.

I’m very new to OH so there are still lots of things to be learned.

Based on the documentation:

NOTE: rrd4j is for storing numerical data only.

In addition to what @Matze0211 has said - when you renamed your persist file RRD4J defaulted back to its default persistence strategy, which is to store all the Items that it can.

Without any persistence configuration openHAB will use use rrd4j for all items.
Using an own .persist file will change this situation, the default settings will be dropped in order to use the own settings.
As stated by @Matze0211 rrd4j is for numerical data only. Depending whether a (string) item contains data readable as a numeric such item could be stored by rrd4j.

Thanks guys. I read from somewhere that rrd4j doesn’t save datetime items but I wasn’t sure about string items.

I have also noticed that mapdb could be used but I have no experience in that so I guess I need to look at mapdb.

mapdb only stores your very last value, which is overwritten every time your value updates.

Yes, I know that but this is sufficient for me. I just want to know what is the latest state of these string items.

But that’s just your current state of your Item though, isn’t it? mapdb stores the current state.

What is your end goal?

Yes, I understand that mapdb stores the current state and it seems to be working. One of these string items contains the mode (auto/manual) of a ventilator in my garage. The other string item has a time stamp for a rheed relay in my mail box so I know when mail was delivered to our mail box. If I happened to restart OH I would have lost the info on last mail. So, I’m only interested in the current state of these Items.

I have to say that the learning curve for me has been very steep but on the other hand very rewarding. I have made lots of progress when gradually migrating from Homeseer to OH.

OK, this is a question about restoring item states on startup. Mapdb is certainly a good choice there. From that docs page:

The intention is to use this for restoreOnStartup items

EDIT: I see now

I missed that!

If your mode is only auto / manual and has no third option, maybe better use a switch item instead of a string, where e g. Manual = off and auto = on

In fact I have a switch which I wanted to invert due to the control of the ventilator so it is easier to use a string item (M=manual and A=auto).

If you already have a switch item: just add state description metadata to you switch item and it will show manual / auto instead of ON/OFF

That would be a neat solution so I could delete my String item. I tried to add a state description to the switch so I put


in the options field but my switch still shows e.g. OFF.

Where do you still see the OFF, after applying metadata?
In the list of all items, in the mainui, custom widget, sitemap…?

I still see e.g. OFF in the list of all items. I have also restarted OH few times but this didn’t help.

The list of all items is ignoring the metadata, but if you add the item to a sitemap or if you use mainUI, you should see the metadata working

For some reason I still have the switch on the mainUI so the metadata is not working.

The switch is visible, because by default a switch item is represented with a switch.

If you do not want to see a switch, you need different type of visualization, but still can use a switch item.
E.g. try a label card that will toggle your switch item once you click on it and will show the configured state description to end useser:

component: oh-label-card
  title: Heating Mode
  item: <Heating_Mode_Switch_Item_Name>
  action: toggle
  actionItem: <Heating_Mode_Switch_Item_Name>
  actionCommand: ON
  actionCommandAlt: OFF

Many thanks Matthias. I got the idea.