Storage of items authored in PaperUI

According to my understanding (warning: I am not a Java developer :stuck_out_tongue:)
All configs (not only including Things/Channels/Items/etc but also other) end up in the openHAB2 service (not clear to me where/how they are kept in thereā€¦ Maybe Java Map Tables and/or Java HashMap Tables ???).

Then, the JsonDB storage service is a storage back-end for selected ā€œareasā€ (Maps?) of OH2. This does not include the manually configured items.

So, I would rephrase a bit: ā€œAll Things/Channels/Items configuration data end up in the openHAB Java Tables(?). The ones created via REST API (PaperUI, HABmin, REST) are stored in json formatted files using the jsonDB service.ā€

Quoting the author (see also here):

The system stores different data into separate tables. JsonDB maps these tables into separate files - in this way each file contains a different type of data (eg. Things, Items, Links).

I started (loooong) time ago to update the content for the jsonDB docs entry, but I got stuck (pinging @ThomDietrich here :blush:).

We could enhance this PR: Add content to jsondb.md by AngelosF Ā· Pull Request #281 Ā· openhab/openhab-docs Ā· GitHub and get it moving forward if you would like. I believe that it will help a lot of OH2 users to understand better the system.

I think that the developers (especially @chris) will help us with a final review of the PR content before itā€™s published on http://docs.openhab.org/.

1 Like

Hi all,

I am in a comparable situation as the original poster of this thread.
I started in Paper UI. It was fine at the beginning implementing nice HabPanel Ui to control my stuff of Homematic and Hue. Now I am progressing (implementing persistence and staring to use rules). Now I have to build Groups and so on. Also I am thinking about doing everything in the files. But I am hesitating as I do not want to kill my system.
If I understand @rlkoshak correct:

I can implement all my items managed via PaperUI up to now with the same names in a ā€œ.itemā€ file and I will cause no issue as the file is dominant. Is this the correct way?
In this case I will implement all Items again with more details in the ā€œ.itemā€ manage the groups and so on there.

Thank you for feedback
Sven

I was specifically referring to binding and OH system configs.

Iā€™m pretty certain you cannot override PaperUI Items by creating the same Item in a .items file.

All Items must have a unique name. You cannot define the same Item in two places and have one take precedence.

Ok thanks for your answer ā€¦ this means for me that I either start from scratch with a new setup to keep my naming syntax or I have to find a new syntax and duplicate all items with an ā€œ.itemsā€-file which are already established via paper UI as I need to deeply modify my structure with groups and so on.

The issue is that I do not trust the paper UI currently. Recently I lost all my items from it with no recognized reason, so I had to detect all items again (binding was still there) and define the names again in accordance to the established dash boards in HabPanel.
Having everything in ā€œ.itemsā€ files would make the system more robust as I can easily backup this file.

Mhh I have to think about that.

The Items and Things created in PaperUI get saved to /var/lib/openhab2/jsondb. Itā€™s a text file you can read and review. If you lost your Items and Things it is because that file either got deleted or corrupted.

Backups are created on a regular basis so if it did get corrupted you can restore from a backup. I think you can even do that within PaperUI.

You can also create and assign Groups to Items in PaperUI. Iā€™m not trying to convince you to not change to .items files, but just trying to show you that you donā€™t trictly have to recreate everything to do everything you are describing.

1 Like

Thank you for the information ā€¦ I will maybe backup the file separately on regular basis.
Currently I found a working solution for ma issue without creating everything newā€¦ I now investigate in rules and ā€œvirtualā€ items ā€¦ also interesting storyā€¦ I am getting deeper in OpenHab day by day thanks to the great community.

So that means to me there is the JSON DB, thing-/item-/rule-/sitemap-files and also some configuration files? And where do I find them?

I use Openhabian and am always lost when I see paths (in the community, tutorials, manualsā€¦) like the one you shared above, because these type of paths doesnĀ“t fit to the Openhabian installation. I guess the path is correct if you install Openhab on Raspbian!

openHABian IS openHAB installed on Raspbian. All openHABian is, is a set of scripts to install and configure openHAB on Raspbian. So you absolutely have the exact same paths as any other standard Linux install.

If you log into your RPi through ssh, you will find all these files in all these same locations.

https://docs.openhab.org/installation/linux.html#file-locations

openHABian is a repository installation.

Things and Items and links between Items and Thingā€™s Channels created in PaperUI get stored in jsondb. Everything else gets stored in text files in /etc/openhab2. See the docs for details.

Ok, you are right! I was a little unclear. I meant for Visual Studio Code I use the network path (samba) \MYRASPBERRY\openHAB-conf to get access to items, rules and so on and that path is different to yours so I had to search.
But that means then that the folder I use for Visual Studio Code is the same one like /etc/openhab2 when using SSH? Or is the network folder an image of it?

Another examle: the logs I can find via SSH in ā€œ/var/log/openhab2/events.logā€, but via samba on my windows computer in ā€œ\openHAB-share\openhab2-logs\events.logā€.

But I canĀ“t find the JSONDB via samba!?

Just to get back to the thread posterĀ“s topic: I find it also confusing that items created in the PaperUI I can use in Visual Studio Code directly (which is great!) but they donĀ“t appear in any item file. So first I thougt I have to define them again in an item file until I found out that they appear then twice.

Yes, /etc/openhab2 gets shared on the network as \myraspberry\openHAB-conf.

How are you looking? I have an openHABian install for testing and the all the logs are placed in /var/log/openhab2. And /var/log/openhab2 is shared on the network as \myraspberry\openHAB-log by default, though by default that is turned off. The intent is to access the logs through frontail I think.

jsondb is a folder located in the userdata folder which is /var/lib/openhab2. That is shared on the network as \myraspberry\openHAB-userdata and, like the logs, by default this folder is not shared over samba.

You can see the samba config and modify which folders get shared by looking at /etc/samba/smb.conf on the RPi.

Furthermore, I think this is by default and if it isnā€™t you can set this up in openhabian-conf from 10 Apply Improvements ā†’ 13 System Tweaks, an option to share ALL the openHAB folders over samba under \myraspberry\openHAB-share.

You can find the userdata folder which contains the jsondb in \myrapberry\openHAB-share\openhab2-userdata on the network.

But the fact remains, on the RPi itself, the logs, conf, and userdata folders are all in the standard locations.

Much work is going on to make the .items file obsolete. Until such time as they do become obsolete there will always be the two ways with OH.

1 Like

Thanks a lot for your answers.
Ok, now I found out that I can the the rules, sitemaps and so on on two network folders:
\MYRSSPBERRY\openHAB-share\openhab2-conf
or
\MYRSSPBERRY\openHAB-conf.

Thatā€™s interesting, do you know why? The log-folder you mention I cannot find.

I found the JSONDB files also on the network folder, it seems like I have missed it (\MYRASPBERRY\openHAB-share\openhab2-userdata\jsondb)ā€¦

You are right, both folders you mentioned are disabled by default!

Hm, I cannot access 13 System Tweaks in the configuration, each time the system throws me back to the root config.

Because openHABian is configured to share the conf folder as openHAB-conf and it will share ALL the openHAB folders under openHAB-share

\MYRSSPBERRY\openHAB-share\openhab2-logs

It ran. All it does is add some text to a config file. It runs almost instantly. The fact that you have openHAB-share available shows that it ran.