Bulkimport Things & Items from file

  • Platform information:
    • Hardware: raspi4
    • OS: bullseye
    • Java Runtime Environment: openjdk 11
    • openHAB version: 3.3

Hi
I have to import a number of similar things and items, clicking on the interface is too cumbersome and too slow for me.
I wonder if there is an ingenious way to import things, items, etc. from files and manage them in the OH3 interface. Using the .things,.items,… file prohibits managing things through the interface, they need to be managed in the object file, which is not very convenient.

Thanks

If you go to Settings → Items → Add Item (blue + button) one of the options is Import from file. This will create UI-based items from the definitions in your .items file.

There is no equivalent for things; those will have to be created manually in the UI.

@JustinG has the .items files covered.

For Things you’ve some options.

  1. Most bindings support automatic discovery of Things. Usually you have to manually create the Bridge (e.g zwave) but then you run a scan and all the devices/Things are discovered. You just need to accept them from the inbox and move on.

  2. For those remaining Things you have to create and configure manually (KNX, MQTT, etc.) if you’ve a lot of similar Things you can make the process a little more efficient. Create your first Thing, test that it works, then go to the Thing’s page and click the “Code” tab. You can copy that and paste that into the code tab of a new Thing, editing those parts that need to be different and leaving everything the same.

  3. Same as 2 except you use the API Explorer to query for the Thing, copy the JSON then edit and POST the edited JSON to create the new Things. This is a little faster because you don’t need to click through to create the Thing initially. You just edit and POST, edit and POST.

I’ll also say, if you have interest in using the Semantic Model for your Items, it’s far less work to recreate your Items using “create equipment from thing” than it is to try to retrofit your existing Items into the model.