MapDB persistence not working for groups

Hardware: RPi 3
OS: Raspbian GNU/Linux 8 (jessie)
JRE: OpenJDK Runtime Environment (Zulu 8.31.1.122-linux_aarch32hf) (build 1.8.0_181-b122)
OH: 2.5.0 (Build)

I’m unable to get MapDB persistence working for a group of items, despite setting the values and checking them through debug logs and the console, they don’t get persisted/srestored. Everything else listed in the mapdb.persist file restores on startup as expected.

Is there anyway to further debug/examine what’s happening with persistence of these values?

Thanks
James

items:

Number Lounge_DarkThreshold     "Lounge Dark Threshold [%d]"    (gDarkThreshold,gLoungeDimLight)    {mqtt="<[mosquitto:test/loungedark:state:default]"}
Number Lounge_DimThreshold      "Lounge Dim Threshold [%d]"     (gDimThreshold,gLoungeDimLight)     {mqtt="<[mosquitto:test/loungedim:state:default]"}
Number Lounge_MinBrightness     "Lounge Min Brightness [%d]"    (gMinBrightness,gLoungeDimLight)    {mqtt="<[mosquitto:test/minbrightness:state:default]"}
Number Lounge_MaxBrightness     "Lounge Max Brightness [%d]"    (gMaxBrightness,gLoungeDimLight)    {mqtt="<[mosquitto:test/maxbrightness:state:default]"}
Number Lounge_TargetBrightness  "Lounge Target Brightness [%d]" (gTargetBrightness,gLoungeDimLight)

mapdb.persist

    Items {
    gLoungeDimLight*    :	strategy = everyChange, restoreOnStartup
    ...

After setting the values (via mqtt), I get the following debug output in the logs:

2020-01-05 07:10:56.632 [INFO ] [pse.smarthome.model.script.testRules] - Item: Lounge_MinBrightness State: 1
2020-01-05 07:10:56.632 [INFO ] [pse.smarthome.model.script.testRules] - Item: Lounge_MaxBrightness State: 50
2020-01-05 07:10:56.632 [INFO ] [pse.smarthome.model.script.testRules] - Item: Lounge_DimThreshold State: 400
2020-01-05 07:10:56.633 [INFO ] [pse.smarthome.model.script.testRules] - Item: Lounge_DarkThreshold State: 80

Before restart:

openhab> smarthome:items list | grep gLoungeDim
Lounge_MinBrightness (Type=NumberItem, State=1, Label=Lounge Min Brightness, Category=null, Groups=[gMinBrightness, gLoungeDimLight])
Lounge_MaxBrightness (Type=NumberItem, State=50, Label=Lounge Max Brightness, Category=null, Groups=[gMaxBrightness, gLoungeDimLight])
Lounge_DarkThreshold (Type=NumberItem, State=80, Label=Lounge Dark Threshold, Category=null, Groups=[gDarkThreshold, gLoungeDimLight])
Lounge_DimThreshold (Type=NumberItem, State=400, Label=Lounge Dim Threshold, Category=null, Groups=[gDimThreshold, gLoungeDimLight])

After restart:

openhab> smarthome:items list | grep gLoungeDim
Lounge_MinBrightness (Type=NumberItem, State=NULL, Label=Lounge Min Brightness, Category=null, Groups=[gMinBrightness, gLoungeDimLight])
Lounge_MaxBrightness (Type=NumberItem, State=NULL, Label=Lounge Max Brightness, Category=null, Groups=[gMaxBrightness, gLoungeDimLight])
Lounge_DarkThreshold (Type=NumberItem, State=NULL, Label=Lounge Dark Threshold, Category=null, Groups=[gDarkThreshold, gLoungeDimLight])
Lounge_DimThreshold (Type=NumberItem, State=NULL, Label=Lounge Dim Threshold, Category=null, Groups=[gDimThreshold, gLoungeDimLight])

Are you using these groups in a rule and do the values eventually return? If so then try using the openhbian-config tool and select to have rules load after OH has started.

Hmmm, strange, seems to be working - I’ll do a bit of digging and see if I can re-produce…

I just noticed the items posted above and you may want to upgrade your mqtt version as the 1.x version will (if not already) be losing support.

When making changes to a .persist file I think it’s still the case that you need to restart OH to pick up the changes. Similarly, you may need to do so to also pick up changes made to the Group memberships. That might be related to what you observed.

1 Like

Thanks both, @rlkoshak, I think that’s it - I noticed when typing out my question that the * was missing from the end of the group name - gLoungeDimLight instead of gLoungeDimLight* , and a subsequent second restart once I’d posted the question picked up the changes.

@H102 - Yes, I’m in the process of migrating away from the 1.x version - I just posted a question[1] on doing so via the rest api as I want to try and avoid creating a fair number of mqtt things manually if I can help it!

Cheers
James
[1] Migrating from text files to Paper UI for Things using REST API

1 Like