Where I am
I have recently updated from openhab 2.5 to 3.2. I added all things via UI and added all items via batch import of the old item files. Now everything is UI configured, no more things + items + rules files. I am quite happy with the result as I could even update my influxdb and continue gathering data.
What I want to do now
Now I want to configure my Semantic Model. Most important things like Light and Temperature of each Room, Humidity and so on
What I miss
Is there an easy way to identify all Room Temperatures and add the required Tags (Point, Property) and Groups (Room Groups)? Right now I have to click on each Item, edit it, do all the changes, save. Next Item. A lot of clickwork.
Can you recommend a way to mass assign Tags?
Unfortunately, that path leads you to a while heck of a lot of work.
The Semantic Model is implemented using Group Membership and Item tags. So to configure your Items into the model you’ll have to create the Groups (for locations and equipment) and tag then as appropriate and then go to reach item and add them to the desired Group and the correct point and property tags.
It can be done but in the end I gave up and ended up recreating my Items using “create equipment from thing” and “create points from thing”. Doing this handles all the Group creation and membership stuff in one go.
I only did an import from my. items files for those items I left it of the model.
Being able to do that is why the model was created in the first place. If there were a way to do that, we wouldn’t need the model.
Hello Korbinian, I don’t have an “easy+mass” way to do this but I could propose a “mass” way. using the openhab API:
get all your items from GET /items, only request the ‘name’ field and any other field that you require to identify the relevant items to add to the model. For example:
save the json file to disk and open it with a spreadsheet, add one or more tags columns and one or more group columns
fill the newly created columns
export the spreadsheet to disk, easiest is a csv file
use a program that can automate api calls from a csv file, for example: postman.
use the PUT items/tags and a similar endpoint for entering the groups
Best to start by creating your locations and equipment before doing this offcourse.
This approach is not easy because you need some data manipulation skills (spreadsheet, api, postman, …). But it allows you to manage certain aspects from a table view instead of item by item. It will depend how many items you’ve got if it’s worth going this route.
You could also just do the semantic tagging first and then these items will show up in the model without a proper equipment/room. Then you can deal with that link item-by-item.
It would be nice if we had a spreadsheet way of managing our items/things in openhab/UI
I don’t have UI powers but I do know a thing or two about excel. So I’ve created an excel file that allows to edit the label, groups and tags of your items. I can’t share it here (forum doesn’t allow the file extension). I’ve put it on my gitlab: Mathias Vanden Auweele / Openhab-spreadsheet · GitLab
It’s an excel file that uses macros to interact with the openhab api. Start by inserting your local openhab host address and API token in the settings sheet. Then refresh the data in the items sheet. When the data is loaded, editing a column label, group or tag (after edit, click enter or change active cell to exit cell edit mode) will automatically call the api.
I haven’t tested this thoroughly yet so be careful (create backup of your configuration…). I’ll probably make a new topic for this as it can benefit more OH users.