PersistenceViewer

I built a simple tabular persistence viewer in HTML, jQuery and AJAX. The first iteration was put together by my wife, using PHP, but I wanted something that I could easily put into HABPanel. A helpful web developer could probably condense it with more jQuery or rewrite it using AngularJS and make it a HABPanel template, but it’s working quite well for my purposes. Hopefully others will find it useful!

Here is how I have it configured in a Frame widget…
image

Known Issues:

  1. After changing the date range, you will need to select the Item name again to refresh the view.
12 Likes

In the Readme you state “5.View your persistence data in a browser at http://[openhab server]:8080/static/history.”
Since you called the file “index.html” the correct call would be “http://[openhab server]:8080/static/”.
Using it through a VPN, my Items don’t show up, will try it later when back on my LAN.

Thank you! I had changed some things last minute… this is cleaned up now. The URL for viewing should be http://[openhab server]:8080/static/PersistenceViewer (or https).

1 Like

Trying to get it working on my LAN now, however I’m still getting only the headers (default persistence is set to rrd4j).

Do you mean the table headers (Items, Time/State? If so, what do you get when you put this in your browser (this is assuming you did not configure a startItem)?

http://[openhab server]:8080/rest/items?recursive=false

This should return all of your items. Do you see any errors in the browser development tools (f12)? And which browser and OS are you using?

Sorry for not being fluent in html.
Yes, I was referring to the TableHeaders.
Using the call the RestAPI as posted above I do get the items displayed.

Checked the index.html and found some missformed lines (probably caused by copy/paste done via a phone). With the corrected file contents it is working!

Great Job!

1 Like

FEATURE REQUEST!!!

Dropdown to choose the persistence service

1 Like

Space was tight, so I added it through a querystring…

http://[openhab server]:8080/static/PersistenceViewer/?rrd4j
or
http://[openhab server]:8080/static/PersistenceViewer/index.html?rrd4j
1 Like

Using this viewer it will make explaining the way rrd4j is saving data in different archives quite easy.
I do foresee the questions: rrd4j needs saving every minute, why does the viewer not show The minute values for the last xx houres/ days etc? Because you are not looking in archive 1!

:+1::+1::+1::+1::+1:

I don’t use rrd4j. Is returning 30 days of data by default too much? I could add another querystring to the URL to configure how far back to go, if no dates are used. Or is changing the dates enough?

Cool, you da man!

IMHO that is enough, in order to look into the different archives of rrd4j one needs to set a specific timeframe. Since that is adjustable the viewer needs this possibility.

Question, is MapDB supposed to display data in the viewer
.
I used:

http://[openhab server]:8080/static/PersistenceViewer/index.html?mapdb
but got only the data from my default persistence (rrd4j).

I would think so, if it’s queryable. I haven’t used it (I’m only using MariaDB (JDBC). What do you get from…

http://[openhab server]:8080/rest/persistence

That gives me rrd4j and mapdb as queryable.
Specifying the serviceID=mapdb does only give an “[]” return

Additionally I am missing some of my Items, especially some that are persisted. Doing a call with the REST API however does show those items.

In the next couple days, I’ll setup some additional persistence services and look into it.

That’s an odd one. Which persistence service? If you look into the index.html, there is some debugging that’s commented out. See if they help troubleshoot. Are those items in groups? If you don’t specify a startItem, then the script will pull in all items that are groups. That is what you’ll first see in the Items table. If you specify a startItem, you will only see the items in that group.

Will look into that after weekend (family meeting because the next generation arrived).

Congratulations,
Baginski 2.0!!

2 Likes

:sob: More like 3.0. Thanks

I found an issue that would have prevented any persistence service from being used other than the default. Try again with the latest. It was working for me with MapDB. And congrats!