OH3 item semantic model group membership bug

Hi!
Running OH 3.2 M5 here

I just came across a strange semantic model item-related bug. This may be tricky to reproduce but I have it on video and I have one last item left affected by the bug.

So. I have a Homie device Thing with multiple properties.

I created four items from channels.
I then (much later) used Create Equipment from Thing, selecting all channels except the first four, writing down the names of the four ones that already had items. (I did this to avoid duplicate items).

After that, I wanted to make the four earlier created items part of the Equipment.
So, for each of the four items, I went to the Thing, Channels, expand one of the four channels, open the channel inside, then click on the Item inside, then Edit, click on Parent Groups - Group Membership, and choose the newly created Equipment.
I did this for all four items – and I’m sure I picked the right Equipment.

Then, I look in the Model page, and the items are all there, but all four are in the root, they are not part of the Equipment!

How odd, I thought.

So, I go back to the Thing, Channel, Item, Edit etc, and indeed it IS set as a member of the correct parent group, so I don’t change anything! I click Save, and go look at Model - Equipment again.

Now, suddenly it appears inside the Equipment as I originally intended! That’s 1 out of 4.

I do it again for item 2. Same thing happens.

At this point I realize that I should capture a video and post about it.
So, here is that video capture, showing clearly that the item is in the wrong place, and that just saving the item settings again fixes it!

I have left the last item (#4) in the wrong place, so at this point, if anyone would like me to grab something out of a database or similar, to figure out why it’s behaving this way (being displayed in the wrong place in the semantic model) in order to track down the bug, I would be happy to do it.

What happens if you reload the whole UI instead of going through the procedure described? There is no event generated when an Item’s Group membership changes so there is nothing to tell the Model view that membership has changed. And it seems reasonable that it caches the Items and memberships from when it’s first called so it wouldn’t show the new membership until the page has a chance to refresh. I wonder if your original procedure doesn’t force the model view to refresh but your follow up procedure does.

Your over all approach to adding the Item to the Equipment is a little complicated though. What happens if you:

  • click on the Equipment in the model tree,
  • click on the Equipment on the right to open the Item’s page,
  • click “change” under Direct Group Members and add the Items that way?

What happens if you just go straight to Items and add the Item to the Group that way?

What happens if you just go straight to the Equipment Group Item in Items and add the Items to the Group that way?

1 Like

I completely forgot to mention that I did hit F5 to refresh the browser – that doesn’t make a difference, the Point stays in the wrong place, even when I try it now.

That’s because I barely know what I’m doing yet :slight_smile:
I was following what I learned here

I did not know about the “Change” under Direct Group Members – thank you!
I was gonna say, “that’s not gonna be useful, it’s a needle in a haystack” and then I noticed it has a FILTER SEARCH BOX!! That is awesome! That is WAY easier than my previous horribly cumbersome method!

I removed it through Change and re-added it again, now it showed up correctly. No way to know if it would have made a difference, but I will definitely use this method next time.

That is a needle in a haystack, and the search box on the Items page doesn’t seem to work at all!
Actually this is a new bug report I suppose. Typing anything into the Items search box just removes the “XXX items” count on top, nothing else happens. The list is not filtered, nothing is highlighted, and the page does not scroll down to where the item is. Even if I scroll down to a matching item, it is not highlighed.

This appears to be the same as clicking on th Equipment in the model tree. Good to know about this shortcut, although for this to be effective the Items search box has to work, otherwise it’s hard to find it among hundreds of items.

Almost everywhere has a filter search box. You will want to look for it and make heavy use of them.

Works for me. I use it all the time. This needs more details. It should work just like it did in the other place.

I have rarely encountered some weird behaviors though if I’ve left MainUI open but not interacted with for awhile. A refresh of the page usually sorts that out. It doesn’t happen regularly enough for me to have filed an issue on it. Maybe something like that happened?

If you refresh MainUI does it still behave the same?

One more shortcut. Bring up the Developer Sidebar (from Developer Tools or by pressing alt-shift-d). Search for the Item(s) and pin them. Once pinned you’ll see a little pencil icon which will take you straight to the Item’s config page. This works for rules, and Things too. It’s a great way to pin all the stuff you are currently working on and flip between them as needed.

2 Likes

Refreshing MainUI fixed the Items search box for me. Oops. Thank you!
And yes, now that you mention it, those search boxes are everywhere. That is excellent. I totally didn’t see them before.

Developer Sidebar has Search and Pin! Man that is useful.

Okay I’m really starting to like OH3. Getting somewhere!

The Developer Sidebar is super useful. Check out the other tabs there too.

You can get a filtered stream of the raw events (kind of like events.log only you get every event, not just item changes and commands). It can be very useful to track when rules are running and Items are updating and such.

The third tab has a place to test widget expressions or launch the -Scratchpad- which is a rule where you can code in random command you may need for testing or the like and run it. Don’t ignore this capability. It is really helpful to have a place to log stuff and send commands to Items and such right there for testing.

Finally, there are links to create just about anything that can be created through the UI. I spend almost all my my time in the Developer Sidebar.

Oh wow. I just did. Okay, this is really nice!

Event Monitor doesn’t seem to work in Firefox for me. At first I thought I was just using it wrong, since no events appeared, so I tried in Chrome and there it magically works great. In Firefox the list stays empty.

Scratchpad is a wonderful concept! Does it still apply even though my primary scripting is in HABApp?

Hmmm, if the event stream isn’t working there I wonder if that’s the root cause of other weirdness you’ve seen. It’s that stream that tells MainUI what’s going on in OH (e.g. Items changing state, rules running). If the stream won’t show up in the sidebar I wonder if the events are being received in other parts of MainUI too.

It’s just a rule with a special name. You can also find it under Settings → Scripts. It doesn’t exist just in the sidebar. The sidebar just has quick access to it. But you will not be able to do stuff like call a rule from the -Scratchpad- and pass data to that called rule. You can’t directly call HABApp rules since OH has no knowledge of them what-so-ever.

But it seems to me that if someone were using HABApp, they wouldn’t be too concerned with mucking around with OH in MainUI anyway. I’d expect you’d have your own test rules in HABApp to do what -Scratchpad- does. It would be a little jarring to move from one environment to another to initiate a test or try something out and experiment.

In your video at ~00:19 (remaining) you can see that under “Semantic Classification” you only have “class: Point”, which is wrong.
After saving the item again on the same table you get another line “isPointOf: Elevator”.
So that’s the openhab-core/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsMetadataProvider.java at main · openhab/openhab-core · GitHub that somehow misbehaved, not the UI which simply creates the tree view from this information - the semantic relationship to the equipment didn’t get built the first time.

Can’t explain why, I’ve seen reports of that happening at startup when one item is sourced from an .items file and the other from the JSON DB (as they are initialized at different times), but your case seems to be different…

2 Likes