OH2 Validate Persistence is working? SOLVED

Is there any way to validate persistence is working? To my understanding I’ve done what’s needed to get mapdb basic persistence working, but I’ve not found any concrete instructions on how to validate this is the case. The only close thing I found was from 2 years ago relevant to 1.x.

I’m just looking for maybe a one-liner on console to output a sample? Or some visual to validate data is being stored somewhere? Something to see that I’m not blindly thinking things work fine when they may not be.

You may use the rest api (restdocs must be installed):

Go to “persistence” “GET /persistence/items/{itemname}”:
serviceid=mapdb
itemname=your_item_name
Click on “Try it out” and you should see something like (for a switch item):

{
  "name": "your_item_name",
  "datapoints": "1",
  "data": [
    {
      "time": 1487572680052,
      "state": "OFF"
    },
    {
      "time": 1487572680052,
      "state": "OFF"
    }
  ]
}

Amazing!! I didn’t know such a nice little utility existed. That worked perfectly and gave me the info I needed. Was also able to turn things on/off and see the updated change when I re-ran the query.

For anyone else, a little elaboration as I stumbled through it:

  • Open PaperUI
  • Navigate to Addons
  • Select Misc tab
  • Install OpenHAB Rest Documentation
  • Navigate back to the root address of your OH install (http://ip or server)
  • REST API will show as a GUI to choose
  • Select the Persistence Section and then enter your item to validate data stored for items
1 Like