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.
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.
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.
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
config:
title: Heating Mode
item: <Heating_Mode_Switch_Item_Name>
action: toggle
actionItem: <Heating_Mode_Switch_Item_Name>
actionCommand: ON
actionCommandAlt: OFF