Items don't persist after restart


I have a problem with MapDB persistence: item’s state do not persist after restart.
After checking the log I see that the values are stored in the databae, but during the startup I cannot see any persistence related log entries (loglevel set to DEBUG for persistence) - except the following:

2020-01-07 00:04:18.193 [DEBUG] [b.internal.MapDBPersistenceActivator] - MapDB persistence bundle has been started.
2020-01-07 00:04:18.232 [DEBUG] [pdb.internal.MapDBPersistenceService] - mapdb persistence service is being activated
2020-01-07 00:04:19.423 [DEBUG] [pdb.internal.MapDBPersistenceService] - Scheduled Commit-Job with interval 5sec.
2020-01-07 00:04:19.426 [DEBUG] [pdb.internal.MapDBPersistenceService] - mapdb persistence service is now activated

Default persistence set to MapDB in PaperUI, mapdb.persist file contains “restoreOnStartup” for the items strategy.
To be honest, the most of the item’s state is set to the good value after startup, but it is due to the retained flag is set. When I delete the retain flag, item’s state is NULL after restart.

I guess there should be some entries in the log if it were restored, am I right?

Show your persist file.

There’s an implication that your Items are linked to MQTT.
You don’t get to set retained or not for any topics you listen to.
Try restore on a non-MQTT Item.

Show your persist file

I will send it as soon as I am at home.

@rossko57: does that mean that restoreOnStartup does not work with MQTT items at all?

There were issues at one time … MQTT would unexpectedly overwrite a restored value with UNDEF. Your binding version would matter if you want to follow that up.
That is not what you describe - but people do muddle NULL and UNDEF.

The “correct” behaviour for an Item linked to an MQTT topic that is retained at the broker - as requested by the remote client - is that binding will almost immediately overwrite any state restored by openHAB with the state from the retained message on the broker, when it subscribes to the topic.


This is my mapdb.persist file:

Strategies {
everyMinute : “0 * * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
default = everyChange

Items {
GFLivingRoomMainLedBrightness : strategy = everyChange, restoreOnStartup
gTemperature* : strategy = everyMinute, everyChange, restoreOnStartup
gHeatingTemperature* : strategy = everyMinute, everyChange, restoreOnStartup
gHeatingTargetTemp* : strategy = everyMinute, everyChange, restoreOnStartup
gHeatingDemand* : strategy = everyMinute, everyChange, restoreOnStartup
gHeating* : strategy = everyMinute, everyChange, restoreOnStartup
gDoor* : strategy = everyChange, restoreOnStartup
gLight* : strategy = everyChange, restoreOnStartup
gGPSTracker* : strategy = everyMinute, restoreOnStartup
gAlarmOn* : strategy = everyMinute, everyChange, restoreOnStartup


I have checked this issue once again. Actually now restoreOnStartup works for switch items and number items, but does not work for the light’s color and dimmer. I use mapdb as this supports storing color values as well. What could be the problem?

Another question: I have updated recently to openHAB2.5 and as I see, after changing the item or rule files and saving them, the values for the items go back to their initial state. Is there a possibility ro extend persistence service to restore the values also in this case?

Thank you in advance!