Problems with Items/Location and Model in OH3

  • Platform information:

    • Hardware: Intel®_Atom™_CPU__C2550/4GB/112GB
    • OS: Debian 10.7
    • Java Runtime Environment: openjdk
    • openHAB version: 3.0.0
  • Issue of the topic:
    I use some Configuration Files for my KNX-Things/Items. When openhab ist running and I modify Location, Point or Property it is correctly sorted into the model-tree. After restarting openhab via “systemctl restart openhab” the item is not longer sorted correctly, its showed “under” the tree.
    No Problem with my Deconz-Items, but these are configured via GUI. I’m not sure if it’s a bug or if I made something wrong :wink: - any ideas?

KNX-Items Configuration (only edit my KNX-Items via Textconfig!):
Switch Abstell_Licht “Abstell [%s]” (GF_Abstell) [“Switch”,“Light”] { channel=“knx:device:bridge:Schalten_EG:Abstell” }

After changing the item-configuration, but before restart:

After restart the Location “Abstell” is empty and the item shows up as a sibling of home. Cannot append a screenshot because I’m new here and not allowed to append a second one…

I can “repair” the modeltree via this Quick-And-Dirty-Action:

  • Restart (and Model is broken…)
  • Edit the knx.items and and “destroy” the first line with some rubbish
  • Wait for Log “Configuration model ‘knx.items’ has errors,”
  • Delete the rubbish
    => Model is shown as wanted…

Does your Item start in an *.items file, and then you edit it in the MainUI? I don’t think that will persist across restarts, as MainUI can’t edit the *.items file.

If you want to add this Item to the model, but want to keep the *.items files, I think you will have to add the information to the file itself.

This might help:

No I’m only editing the KNX-Items via my “knx.items”-File. After changing it apears correctly under “Model” as shown in the screenshot but doesn’t like a restart… :frowning: The config in my posting is the edited one… “GF_Abstell” is the “Abstell-Group”.

Added some info to the first Posting…

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)

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: