Storage of items authored in PaperUI

I might be misremembering as well. I’m on travel with no a laccess to my system, and even then I don’t define Items via the UIs. I can’t find the thread where that was discussed anymore either (it’s hard in the phone).

What would be most intrude to the user is the ability to do everything through the UIs. And that is the direction OH is heading. It just isn’t quite there yet.

The discussion about saving everything in .items files has been had and decided.

What is stated in the docs is that you have to restart openhab. What isn’t stated is that you should stop openhab before editing the files, that’s my experience anyway. I edited the files as per the documentation, restarted openhab and it had rewritten the files, presumably on shutdown. So it seems to be “stop, edit, start”, rather than “edit, restart”.
That’s all.

The docs should be updated. Can you open an issue on the openhab-docs repo?

I have a mix of different setups and checked the JsonDB right now:

  • Things and items configured in text files don’t show up in JsonDB
  • Things via PaperUI, items via text files don’t show up in JsonDB
  • Things and items configured via PaperUI do show up in JsonDB (surprise :slight_smile:)

I guess @tomq42 is busy setting up his openHAB system, so I created a PR:

1 Like

Tom i faced the same problem when i started using openhab2. Created everything in Paper UI, when i see some missing properties i switched to config files, then trying to use the full potential of openhab2 switched back to paper UI, and then when i update OH2 lost all settings, switched back to config files and so and so. After some serious struggle, i set up my system like this, and happier since:

Paper UI: Install necessary Bindings and create ZWave things if there are any.
Things File: Create everything in .things file except Zwave, since in OH2 you cannot assign parameters to zwave node channels, like invert_percentage.
Items File: Create all of your items here in .items file, very easy to manipulate and update since in OH2 all items are sorted according to their labels, not item names and very hard to find an item after a certain number.
Sitemaps, Rules, persistence, scripts, transform files: All config files.

As you have realized anything you create on config files appears on Paper UI without any jsondb file, and they are read only under Paper UI. And anything you create on Paper UI is only available as jsondb file, and editable on Paper UI.

The more you use configuration files, easier to backup your system. If you change anything in config files you do not have to restart OH. Yet again, this is my thought, you are welcome to try anything. And this is for the current situation, i hope someday i will be able to handle everything in Paper UI :slight_smile:

1 Like

Whilst I agree in principle, the user interface has to be pretty sophisticated to keep the power users happy. At the moment it seems like it’s the worst of both worlds in a way, in that you can get started with PaperUI, but after a while you reach the conclusion that you’d be better of with .item files instead. However that’s a hard transition because everything you’ve got is now in JSONDB. Indeed I’ll probably write myself a utility to read the JSONDB files and write .item files from it.

As an example, I was trying to set up groups for things earlier. I wanted to put all the “battery” items into a group. My word it was hard work in the PaperUI, and I’m not convinced I’ve got them all. You select an item, and edit it to add the group. You go back to the item list and you’ve got no idea where in the list you where, so what the next one to look at was. If you happen to also change the label while you are at it, you’re completely lost, as the item list changes order! With an item file it would be an easy scan to check that I’ve got them all, and it’s easy to go through them one by one.

I can imagine improvements that would make this much easier. For example, being able to add items to groups, as well as groups to items, and maybe having all items listed with check boxes next to the ones in the group (for example).

Anyway, I think I’ve come to the same conclusion as @febz11 above, and will move that way too.

I think I’ve come to the conclusion that this is the right way, at the moment.
It’s sad in some ways. Initial item creation is much simpler within PaperUI, but most other things it seems are just not. Until such time as I have the time to understand how the code works to the level that I can contribute to it, I think I’ll migrate to using item files too (most of my “things” are zwave).

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.