Guidance for Renaming Things on OH 3.2.0 (Insteon Binding)

I decided to rename my Insteon Things to better reflect their location and role. The rename via the the user interface appeared to work fine, but all the renamed Things were no longer responding and the log showed numerous warnings about “Attempting to send a state update of an item which doesn’t exist”. A search popped up https://community.openhab.org/t/oh3-rename-items-in-ui/128575 which was rather worrisome but it turns out restarting OpenHAB solved the problem, although I am still seeing:

[WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Insteonopenclose2_Contact

I cannot find anything in Settings/Items for Insteonopenclose2 but it appears in org.openhab.core.thing.link.ItemChannelLink.json and uicomponents_ui_page.json. Do I need to manually edit the JSON files?

It’s not clear what you’ve actually done because the error doesn’t match the description of what you’ve done.

First let’s lay some ground rules.

  1. You cannot change a Thing’s “Identifier” (i.e. its unique ID) once a Thing is created.
  2. You can change a Thing’s “Label” once the Thing is created.
  3. You cannot change an Item’s “Name” after it is created. What happens here is you can delete an Item and recreate it with a new name, but everything that referred to the old Item needs to be updated too: links, rules, UI widgets, etc.
  4. You can change an Item’s “Label” after it is created.

In 1 and 3, MainUI will prevent you from making the change.

So, given that Things don’t have names and you can’t change an Item’s name through MainUI in the first place I’m at a loss to understand what you’ve done. More details are required.

The error you are seeing comes from the fact that you have Links between a Channel and an Item that refers to an Item that doesn’t exist. So maybe you did change an Item’s name, but how did you do it?

I think of the Thing/Item label as its name. I had originally added an Insteon Open/Close sensor through the binding and labelled it “Insteonopenclose2”. I created an item for the Contact so I could do some OH3 testing. Most other Insteon devices were only added as Things.

I changed the labels of the Things (including Insteonopenclose2), added them to the Model, and at the same time selected the channels to automatically create items. I subsequently changed some of the Thing labels for consistency. I do not recall changing any Item labels manually - i assumed they inherited the name of the Thing. Since an OpenHAB restarted solved most of my problems (sending/receiving to devices, warning messages), I moved on to my next challenge but thought I would post what happened. I can go back through the logs and gather more information.

Well, these fields have a term and when you don’t use that term we don’t know what you are talking about. Especially when an Item has a field very clearly marked as it’s name.

You can think of them how ever you want but need to use the correct terms when talking with others or else confusion will reign.

Here’s a good case in point. Things are not added to the Model, only Items are.

There’s a lot going on here. We have before us a Choose Your Own Adventure novel of options for how to identify what went wrong and how to fix it. But we’ll never be able to pick the right path if we are not using the terms for OH concepts correctly.

Thing labels are only ever used for display purposes so assuming you are referring to

something else is the cause of the problem.

What happened to that Item? Does it still exist? If not does the Link to this Item still exist? It is sometimes possible to delete an Item without deleting the Link resulting in an orphaned Link. The binding will still be trying to send updates to an Item that doesn’t exist.

If this is the case, go to the Item and open the Channel that was linked to this Item. It should show that Link still there. If it is, click on it and then you can remove it.

You have the option to modify them before creating the Items when using the “create equipment from thing” or “create points from thing” option.

By default it will use the Name and the Channel name for the Item. In the screenshot above the “Allspeakersgroup” is the “label” of the Thing and “Location” is the “name” of the Channel. Because a Thing can have multiple Channels and Channels are linked to Items.

The label is usually just the name of the Channel but that becomes a problem when you have a dozen light Items all labeled “Light”. You usually want to modify those to use a meaningful label (e.g. “Family Room Lamp”).

I have only modified Thing names - In the Create Equipment from Thing step, I accepted the generated names. In Settings/Items, there is no reference to “Insteonopenclose2” or “Insteonopenclose2_Contact” listed in the WARN message in my original post. I checked the renamed Thing and Item - the channels and link definitions look fine.

I did find a reference to “Insteonopenclose2_Contact” in an Overview page widget (now removed). I still find references in org.openhab.core.thing.link.ItemChannelLink.json that appear to be orphans. If I search on the uid “insteon:device:hub2:51D7E5:contact”, I found references from both the old and renamed Thing label.

The label is irrelevant. The label is strictly for your benefit and is not used in any other way by openHAB itself. You cannot generate any error message, let alone that specific error message, by changing the Thing’s labels.

As expected. The error is telling you that those Items do not exist so I wouldn’t expect to see them there. They don’t exist.

Checked how? Look fine how?

I’m not positive that would generate the error that you saw. MainUI never updates an Item. However, the error is coming from the SSE which is a feed of events that MainUI subscribes to so maybe it is related. I assume the error didn’t go away after removing the widget?

Do these Links not show up in the Thing’s Channels page?

More likely you are not interpreting what you are finding. You’ve change the Thing’s label. It’s now changed. That Thing label does not exist anywhere beyond the Thing’s definition in org.openhab.core.thing.Thing.json. Anywhere else you see that label is either an Item name (which is not tied to the Thing’s label in any way) or coming from one of the backup files.

These orphaned links you’ve found should show up on the Thing’s Channel as shown in the screenshot above. If so you can click on them and delete the link.

If for some reason they do not, you can log into the karaf console and issue the command openhab:links orphan list to see the orphaned links and openhab:links orphan purge to remove the orphaned links.

After removing the Overview page widget that referenced “Insteonopenclose2_Contact”, there have been no more error messages.

When I noticed that my Insteon devices were not responding after changing the Thing label via the Main UI, I saw a lot of warnings in the openhab.log relating to items that no longer existed, such as:

2022-07-10 16:50:33.955 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: bdInOpenClose
2022-07-10 16:51:57.906 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Insteonopenclose2
2022-07-10 16:59:57.544 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: bdInOpenClose_BatteryLevel
2022-07-10 17:00:44.388 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Insteonopenclose2_Contact
2022-07-10 17:00:44.390 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Insteonopenclose2_LastHeardFrom
2022-07-10 17:19:51.404 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Insteonmotionsensor1
2022-07-10 17:24:31.953 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: Insteonmotionsensor1_BatteryPercent

All but the Insteonopenclose2 warnings disappeared after I restarted OpenHAB

The Thing label “Insteonopenclose2” was changed to “fd In OpenClose”. The channels for the latter show the correct Contact and LastHeard Channels/Points.

Thanks for the “openhab:links orphan list” tip. The command shows:

Item missing: Insteonopenclose2_LastHeardFrom -> insteon:device:hub2:51D7E5:lastHeardFrom Configuration[]
Thing channel missing: bdInOpenClose_LightLevel -> insteon:device:hub2:51DFB6:lightLevel Configuration[]
Item missing: Insteonopenclose1_LastHeardFrom -> insteon:device:hub2:47F50E:lastHeardFrom Configuration[]
Item missing: Insteonmotionsensor1_LightLevel -> insteon:device:hub2:4F8AB6:lightLevel Configuration[]
Item missing: Insteonopenclose2_Contact -> insteon:device:hub2:51D7E5:contact Configuration[]
Item missing: Insteonmotionsensor1_LastHeardFrom -> insteon:device:hub2:4F8AB6:lastHeardFrom Configuration[]
Thing channel missing: bdInOpenClose_TemperatureLevel -> insteon:device:hub2:51DFB6:temperatureLevel Configuration[]
Item missing: Insteonopenclose1_Contact -> insteon:device:hub2:47F50E:contact Configuration[]
Thing channel missing: bdInOpenClose_BatteryPercent -> insteon:device:hub2:51DFB6:batteryPercent Configuration[]
Thing channel missing: bdInOpenClose_TamperSwitch -> insteon:device:hub2:51DFB6:tamperSwitch Configuration[]
Item missing: Insteonmotionsensor1_BatteryPercent -> insteon:device:hub2:4F8AB6:batteryPercent Configuration[]
Thing channel missing: bdInOpenClose_LowBattery -> insteon:device:hub2:51DFB6:lowBattery Configuration[]
Item missing: Insteonmotionsensor1_LightLevelAboveBelowThreshold -> insteon:device:hub2:4F8AB6:lightLevelAboveThreshold Configuration[]
Item missing: Insteonmotionsensor1_Contact -> insteon:device:hub2:4F8AB6:contact Configuration[]
Thing channel missing: bdInOpenClose_LightLevelAboveBelowThreshold -> insteon:device:hub2:51DFB6:lightLevelAboveThreshold Configuration[]
Thing channel missing: bdInOpenClose_BatteryLevel -> insteon:device:hub2:51DFB6:batteryLevel Configuration[]

I think I know what happened to the bdInOpenClose Items and Thing Channels - when I added the Insteon open/close sensor, I entered the motion sensor product type by mistake. I noticed the problem after the Create Equipment from Thing. I deleted the items, changed the product type, and did another Create Equipment from Thing that correctly added the Contact and LastSeen items.

I am going to clean up the orphan links even though I am not seeing any warnings in the logs. After upgrading to OH 3.3.0, I will test out changing Thing labels to see if the issues reoccur and the exact steps required to recreate them. Might be a few weeks before I get back to this - I need to pivot to some other projects.

To avoid orphaned links in the future, especially when doing so because of messing with a Thing, delete the Items from the Thing’s Channel page. You can “Unlink all Items” to just remove the Links or “Unlink all Items and remove Links” to remove the Links and Items. Or you can do them one by one under the Channel.

Thanks for the suggestion. I will test it out when I get a chance to determine the implication for other parts of OpenHAB, like Rules.