Mixing gui and files for semantic model?

Should it be possible to define part of the semantic model in gui and part in files?
I have some things/items defined in the gui and some in files so I created the basics of the semantic model in the gui and tried to add the relevant tags to the item files. This seemed to work at first but after a restart of openhab everything from the files is at the root level but still connected. So a equipment with subequipment with points is still grouped together but at root level instead of in the specified room.
“Direct Parent Group” and “Direct Group Members” still show the connections, but the semantic model does not recognize the connection.

This is a snippet from my .item file:

Group Kuehlschrank "KĂĽhlschrank" <whitegood> (Kueche) ["WhiteGood"] 
Group Kuehlfach "KĂĽhlfach" <whitegood> (Kuehlschrank) ["Refrigerator"] 
Number Temperatur_Kuehlschrank  "Kühlschrank [%.1f °C]" <temperature> (Temperaturen,Temp_sonder,Kuehlfach) ["Measurement", "Temperature"] {channel="jeelink:lacrosse:Kuehlschrank:temperature"}

I think this should work - at least, it does for me. However:

  • You cannot modify Items using the UI if they were first defined in configuration files. The UI sometimes lets you modify stuff, but the modifications will disappear.
  • You cannot modify Items using configuration files if they were first defined in the UI.

I should probably say must not rather than cannot in the above, because it is possible to try both of those things in reality, but results will be less than desirable!

It should be possible but there is a whole lot that can go wrong.

  • What if the .items file is loaded before the Group is loaded out of the JSONDB?
  • What if a Group has a mix of Items defined in files and in JSONDB? Do the ones if files overwrite those in JSONDB (as is usually the case with files).
  • At what point is the model created? Is it before, after or during the .items files loading?

Any one of these could result in the type of behavior you describe.

But there is no way how to influence this, right? So in the end it is not possible?

If any of those are going wrong. There isn’t enough information or knowledge to know if any of that is occurring.

Sorry, I don’t get what you are trying to say.
Should I provide more information? If yes, what would be needed?
Or is Openhab 3 too new and this is untested? Then maybe I should file a bugreport.

I think you need to look in the logs and try to figure out when things like the loading of the .items files occurs relative to the Items being loaded from JSONDB. From there you can try to determine whether one of the timing issues from above is what is happening. From there that may reveal if there is a bug and if so, where the bug might reside.

Doesn’t matter. You can even specify nonexisting groups and everything works.
Once you create the group the items get put into it.

Doesn’t matter.

My model also got mixed up. I first created it in the UI, but then started importing my *.items files from OH2, that’s when things went wrong.

Main problem was, that I used the same group names in the semantic model for the floors and rooms that were already used in the item files. So after a restart, the gEG (for ground floor) in the semantic model was gone, because it was overwritten with the one in the item files that didn’t have any tags.

I ended up renaming these groups in the item files which solved it for me.

I tried to do a very simple test:
First I created a location in the model:
Then I added an item in a .item file:

Number test_item "Test Item" <temperature> (test) ["Measurement", "Temperature"]   

The result was this:

After restarting openhab it looks like this:

1 Like

Interesting test, similar effect I had:

I assume the order is:

  1. Group is created when you define a location in the model
  2. You add an item, it gets assigned to the group
  3. When you restart OH3, it first loads your item files. Somehow, it sees a group called “test” and creates it (even though you didn’t specify it?).
  4. The group created through the model is not loaded properly as location, thus the model is mixed up.

In my case, the group / location created in the model wasn’t even displayed anymore after a restart.

Not sure if that’s the right interpretation. Anyway: I guess it’s safe to say that you really shouldn’t define the same groups in the item files and in your model :smile:

1 Like

I just retried it in OH3.2.0 and the behavior remains the same.

I have +350 items in item files that are generated from my Vantage Qlink configuration.
I prefer to enter the Semantic model by GUI (as otherwise, theyse items are Read-Only in the GUI)

If JSONDB is loaded first and I put the .item files later => everything is ok.
If both are present at boot => Nok, the .item files are processed first.

Is there in OH 3.2 a method to define the order of loading at boot?