Moving items to text

Hi everyone quick question

When I first started setting up openhab I used paper ui too install my bindings select my things and link my items, my rules were also created in paper ui

I’m a bit more familiar with how openhab works now and I have been slowly trying too move all my stuff over to text based files

I have successfully moved all of my rules too text files and also moved some basic items over these items switches ect that are not linked to any binding or thing

Now I’m ready too continue moving the rest of my items over too text

Is there a process for doing this?
Should I unlink the item from the thing first using paper ui? or can I just write a duplicate item in the text file would this just replace the paper ui version?

Yes, unlink the item first
Then you can use the same item in your rule

eg:

String myItem { channel="xxxx:Xxxx:xxxx:xxx" }

You can copy and paste the channel information from the paperUI
You’ll end up with the same item and the same binding BUT now you can add formatting, icons, tags and other bindings in the text file which you couldn’t do in paperUI before

I have not seen this channel info before or delt with it is that what’s needed after the item so the item knows what thing it belongs too?

EDIT I have seen it when I added the Philips hue motion sensors they needed to be added with text files was not possible with paperUI but im still unsure how that worked I’m getting there :wink:

Number House_NestAmbientTemperature          "Ambient Temperature [%.1f °C]"             <temperature> (Thermostats, Temperatures)                                           [ "CurrentTemperature" ] { channel="nest:thermostat:bca14bfe:dCd2AOytHIiKRTYPM00jxva1Q3Ryl-jm:temperature" }
Number House_NestHumidity                    "Humidity [%d %%]"                          <humidity>    (Humidity)                                                                                     { channel="nest:thermostat:bca14bfe:dCd2AOytHIiKRTYPM00jxva1Q3Ryl-jm:humidity" }

Does that help?

1 Like

That’s on the things tab where you create the items not in the items page I forget there was info there yes it helped alot

Hue:0100:001788…alert That part is the channel info for the alert of kitchen bulb

I did do one item without adding that channel info it seemed to work OK still I will try to change it anyway

@rlkoshak do you know why Paper ui writes the files too a dB instead of too the text files?

Just to be clear, Items and Things created through the REST API, as PaperUI does, or through the commands in the Karaf Console ARE when to a text file. JSONDB is a JSON formatted text file. You can even edit it by hand if you choose to.

The reason they moved to a DB is because the Xtend based syntax the text config files like .items files awkward to work with and difficult to extend and expand. It is also challenging to represent complex relationships. So when they created the concept of The to enable automatic discovery they had to come up with a new format anyway so why not move to something that will be more viable in the long run.

Initially, they used MapDB to store this info but MapDB was not human readable, was prone to corruption, and was pretty slow. Then Chris created a pr that switched over to JSONDB and most of the problems with MapDB were solved.

.items files and all the rest will continue to bed around for the long haul but over time I persist that there will be less and less reason for users to start with these text files. For now and probably for a long time we will remain in this inbetween place where sooner things will work better with the text files and others work better or are only possible with the JSONDB.

Is there an easyer way too move all my items too text

Are you saying don’t move my items

2 Likes

Not at all. I’m just explaining why the devs decided to create something new rather than just extending the old text files. For now and the foreseeable future the text files will remain more attractive for experienced users.

Thanks for your help on this i am now racing through my list of items and replacing them with text versions i have had a few problems but managing nicely and will soon move onto replacing my things that were created by paperui

is there a text file for the bindings/actions/transformation/persist ect that are installed ? as the system grows remembering what bindings ect are installed will be tricky im also wondering as this would also help if i ever reinstall a fresh copy of OH i would not need too install them by hand then

@rlkoshak i will carry on doing what im doing then

conf/services/addons.cfg

Thanks for that i have just had a quick look at it will look again soon

Be careful with that. Although i moved everything to text files, i do not use addons.cfg. This file takes priority for all addons. Addons installed via PaperUI will be removed. (i guess at a restart, but i am not sure. )

Not for all addons.
For example I moved my bindings there but not the actions, transformations, tts…

BUT put ALL your add ons there or as mentioned, the ones not on the list will not be installed.

Thanks. Didn’t knew it was per category. Thought it was all or nothing.

Just as a point of reference, I don’t bother with .things files. The only reason I have any at all is because bindings like Nework and Astro didn’t support creation of Things through the UI when I migrated to 2.0. if a binding supports automation discovery, I’ll user that every time rather than creating text files.

You can always query the karaf console or the r we still API if you need the last. Or you and use addons.cfg to manage which add-ons get installed instead of the ui.

Six months ago I would have said yes. In fact it was the easiest way to manage running OH in Docker containers. Now that the container support a reasonable upgrade process I don’t know that it is required. If you want to make sure that you can rebuild from only want is in /etc/openhab2 then you will want to use addons.cfg. if you also back up and might /var/lib/openhab2 then it doesn’t matter so much.

It happens as soon as OHb reads in the file.

This is an important nuance. If you keep a line connected out then that category of add-ons will not be managed through addons.cfg.

DISREGARD THIS POST

Hi again everyone i was just about too load paperUI and continue moving my items but im now receiving error 500 looking at other posts about error 500 looks like it may be related too what i have done here