Using the below mapdb.persist code, shouldn’t the variables I assign to the group RestoreOnStartup group persist automatically? These values were not seeming to be stored until I added a restoreonstartup.rules file.
Am I missing something, or do I have to use the .persist method to force each individual variable to store it current value?
mapdb.persist
Strategies {
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
}
Items {
RestoreOnStartup* : strategy = everyChange, restoreOnStartup
}
restoreonstartup.rules
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
rule "Persist on change: BackyardBluetoothState"
when
Item BackyardBluetoothState changed
then
BackyardBluetoothState.persist
end
rule "Persist on change: AtHome_Brian"
when
Item AtHome_Brian changed
then
AtHome_Brian.persist
end
default.items
Group Backyard
Group Harmony
Group RestoreOnStartup
Switch AtHome_Brian "Brian" <present> (RestoreOnStartup)
Switch AtHome_Nerene "Nerene" <present> (RestoreOnStartup)
String BackyardBluetoothState "Backyard Bluetooth [%s]" <bluetooth> (RestoreOnStartup, Harmony, Backyard)
P.S. I am using the refresh.rules methodology described on the Persistence wiki to restore persistent values at startup.