Bulk editing metadata of Items

I’m running openHAB3 on Raspbian Buster.

I am gradually moving away from file-based Item and Group definitions as you can’t perform some editing actions on such Items and Groups in mainUI.

I have a very tedious job involving editing tens of nearly identical Items and Groups: set the default list item widget, set the widget weight, set the state representation format and mark it read-only to avoid toggling / editing states unintentionally through mainUI. Doing it in the UI will be prone to errors (forgetting one edit on one Item or Group).

Is there a way to bulk edit such Items and Groups?

If not, is it possible to point at the database file containing the Item and Group definitions so I can implement the changes by hand myself?

I’m also interested in this. I stalled on my transition and left a bunch of trickier items in text files, while everything else moved to MainUI. And now I can’t commit to either direction since they both have different strengths. :wink:

It’s just so convenient to be able to copy/paste a line of text and then create a new item with a few text edits, or to comment out an item to remove it. Of course, I only think that since I’m used to doing it. I remember how hard it was to wrap my head around text configs when I started.

Having the ability to bulk-edit and clone items in MainUI would be very helpful for intermediate/advanced users. I don’t see any issues in openhab-webui, but I may not be using the right search terms.

You could try to use the batch upload feature (developers options) which allows you to upload a textual configured list and supports some of your details (i.e. semantic properties, state description?, Maybe more?).
It should also update existing items with new variables. But would also require to first have a textual list obviously.

using the REST-API might also be an option.

I started from the .items file and added the items from their textual definitions through settings > items > +

I didn’t find any examples so far of the new MainUI “metadata” to attach to a textual definition.

That could be helpful for bulk updating existing Items. If I can figure out which REST operations I will need and which payload is required.

Not sure either it possible, only found this post here, but it is more talking about locations etc. via files.

1 Like

it should be relatively easy.
Go to your Openhab instance (port 8080).
Chose RestAPI, search the ITEMS Marker and click “show/hide”.
Now you see all possible commands an can even utilize the commands here.
E.g. click on the “get item”, click on “Try it out” and you get the whole list of your items incl. payload in the response header in JSON format.
You can copy the response header, bulk edit the elevant items e.g. by copy/paste and put them back by using the “PUT item”.
It seems, that you can only overrite them item by item, but this is also just a copy/paste.

1 Like

Thanks! It’s actually this thread (referred in your link) which gives the clues: