Problems with Items/Location and Model in OH3

I hit the same issue. I don’t think you or I did anything wrong. I think it’s a bug. I decided to work around it by just putting the items directly in the db via the MainUI and removing the *.items file. The items that are entered directly via the MainUI do appear to stay in the model as expected even after a reboot.

I did this by:

  1. Made a copy of the *.items files outside of the openhab file structure:
  2. Delete everything in the *.items files that are still in the openhab file structure.
  3. Use the MainUI to import the items in the *.items files I copies. (settings -> Items -> bottom right of page)
    image

I did hit an issue with one item type. If you have a Group:String with a custom aggregate, it won’t import correctly and there is no way to configure a Group:String correctly in the MainUI as far as I can tell. I think it’s a rare use case. My workaround for that was to leave just that item in a *.items file.

I might have hit a few other minor issues (can’t remember), but as a whole it worked fairly well.

I know this option, but I like the configuration files too much for my KNX Items :wink: . I often use the possibility to make changes to many objekts via this files…

1 Like

Is there a solution on this by now? I am facing the same issue…

Are any of your Items, which are part of the Semantic Model, configured using the UI?

@hafniumzinc thanks for your reply.

yes, I started with UI, then I realized, that this is to much effort and switched back to my old config files. Currently I guess I have still some UI configured items as well as all locations are still part of it. I will replace them by config items in the future because config configuration is much more comfortable for me…

is there a relation?

Yes, absolutely! No-one seems to know in what order everything is loaded upon a restart, so the recommendation for Items which form part of the Semantic Model is either all UI or all files, but not a mixture!

My notes on implementing the Semantic Model in files are here:

I’m hitting exactly the same issue. Did someone solve it somehow? I would also like to keep my items in files. Mass changes through UI is not so funny :).

What is your issue?

The semantic model uses groups, and items in a group are essentially unordered (for the most part, usually the order of creation is used, but as mentioned this changes on restarts) so the shown order is coincidence.

Then again it is not an “issue” because “order” is not a feature. Simple as that.

And ultimately it isn’t an issue because this part of the UI is not meant to be used by users.
Create the UI for users via ‘pages’. Lots of options to determine look and placement (hence order, too) there. No need for ordering in the model.

What is your issue?

Well, what this thread is all about. Assigned items to semantic model (groups) are working when editing item files “live”, but after a restart, they do not appear in the model anymore. I also have the issue with KNX items - I guess the reason is, that they take some time to initialize after a restart and maybe the semantic model is build before they are available.

Then again it is not an “issue” because “order” is not a feature. Simple as that.

Not sure if I get this right. I have no issue with “order” of items in the semantic model or somewhere else. It’s about assigning items to the semantic model I created. Like House->FirstFloor->BathRoom->MyRollershutter. The item MyRollershutter is not under BathRoom anymore after a restart.

Look at the first image in the post. Abstell (Switch) is in the semantic model when live editing item files. After restart, this guy is moved to the root of the semantic model (so loses the assignment to the Abstell (Location). The poster was calling this “shows up as a sibling of home”. For me it’s outside of the model, just appearing the the bottom of this view. Again, it’s not about its actual ordering, but that it’s outside of the semantic model.

I hope this is more clear now.

OK, so one of the things discussed in this thread is combined Items and GUI configuration of the semantic model, which doesn’t work out so well. Are ALL your Items and semantic model groups defined in Items files? You haven’t tried to configure anything via the UI?

Well if you edit files and try to get them into the model you’re doing something substantially wrong there
(unless you’re a real expert but then you wouldn’t ask this I guess).

Either use files or the UI to create items but don’t mix. The warning in the docs telling you not to is large, isn’t it.

So either define the model, too from within .items files (which is really for experts only who understood the whole stuff well) OR don’t use .items files. Instead, create them outside /etc/openhab/items and import them with the option shown in the picture some posts up or create them through the UI.
Else all sorts of weirdnesses will show up which is probably what’s hitting you.

Not sure which documentation you mean, but I couldn’t find any warning regarding existing items in files and that they are not supported in the semantic model docs. It actually says, that existing items can be added via UI. I guess it’s missing the nasty details at this point.

But anyway, thanks for the pointers that mixing is definitely not supported (I have the semantic model defined via UI, and hoped I can assign the items from files). Is there any restriction (besides the obvious - not being able to copy/paste and search/replace) having the items in the UI? Like some parameters not possible or some things not supported by certain bindings via UI?

Interesting: Mixing gui and files for semantic model does not work · Issue #2106 · openhab/openhab-core · GitHub

Cool, thanks, I didn’t check all the docs for the 3.0 release for changes. Actually I’ve started now to switch from item files to UI - let’s hope it does not bite me later on :crossed_fingers:

The quoted contents actually hasn’t really changed for 3.X in substance, it’s been valid for 2.X already.

The documentation clearly states that “It would work to mix these” (mix files and GUI) but it is not recommended. But as reported here in this thread and also here it does not work. It would be nice to get some feedback, if this is a bug which should get fixed or if it will stay that way.

Well, although people like to read it that way, docs don’t say that any form of mixing will work, does it ?
It does work if you always strictly use only either text or UI for a specific item but that you didn’t do when you started applying the model (via UI) to text-defined items.
So it is not a bug. Because of that and because it has been like that in years, in all likelihood it will stay.

EDIT: created a PR against the docs to clarify

Thanks for clarifying the docs! I’m still not sure I understand it though. You write: “You must not create an item using files and then make use of it in the model using the UI”
What is meant by “make use of it in the model”? I didn’t find any way to change items in the UI if they were created by file. And that is not the issue I have.
I create one item (including semantic tags) in file and one in UI. If the one from UI is a child of the one from file it works, but the other way round does not work. My current understanding from reading this thread and others is, that it it pure happenstance that one way currently works and the other does not, this could change at any time. If that is true I would expect something like this in the docs: “When using the semantic model, the whole model and therefore all items used in it must be created either in the UI or with files. Using both is not supported.”