Little Orphan Item

I have an item which is not editable and which I can’t remove, though it’s no longer connected to anything. The item was created in PaperUI to control the brightness of a Hue white bulb.

I am in the process of removing the Hue hub from my setup and putting the Hue bulbs directly into my setup using a Zigbee stick. My (now updated) process is the following:

  1. Remove any bulb-related items and then things from openhab in PaperUI
  2. Remove the bulb from Alexa and then from the Hue Bridge
  3. Use hue-thief to remove the bulb from the Hue network
  4. Discover the bulb with the Zigbee binding in Openhab
  5. Set up the item(s) needed for the bulb
  6. Add the “Lighting” tag using the Rest API method; discover into Alexa

This process works just fine. Unfortunately, there is one bulb for which I forgot to remove the item from my openhab configuration before removing the thing, and all the hue/alexa connections. That bulb works just fine via the Zigbee binding, but I have an “orphan item” based on the old configuration that I cannot delete. There is no trash can next to the item in PaperUI, it’s listed as not editable, and I can’t delete it using the Rest API either.

Is there any way to get rid of this orphan item?

First check carefully if you have any xxx.items files that contain an Item of this name.

I don’t - it was set up using PaperUI. There might be a .rule file with it referenced - would that keep me from deleting it?


I bet that what happened is the Link to the Item remains but the Item does not. To fix this you will need to edit the JSONDB.

  1. Shut down openHAB
  2. Navigate to $OH_USERDATA/jsondb (e.g. /var/lib/openhab2/jsondb).
  3. Open for editing
  4. Look for the name of your Item in the list and delete the entry. An entry looks something like:
  "mg_Test -\u003e mqtt:topic:test:test": {
    "class": "",
    "value": {
      "channelUID": {
        "segments": [
      "configuration": {
        "properties": {
          "profile": "system:default"
      "itemName": "mg_Test"
  1. Save and close the file.

  2. Open org.eclipse.smarthome.core.items.Item.json for editing.

  3. Search for your Item and if it exists, delete the entry. I suspect there will not be an entry for that Item. An Item entry looks something like:

  "mg_Test": {
    "class": "org.eclipse.smarthome.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [],
      "itemType": "String",
      "tags": [],
      "label": "test"
  1. Save and close the file.

  2. Start openHAB again, watching the logs for errors. If nothing went wrong the Item should now be gone. If something did go wrong, stop openHAB again and restore the most recent version of the one or two edited files from $OH_USERDATA/jsondb/backup and try again. Pay special attention to the curly brackets and commas.

There is no entry in the Items file, just the Link file.

When I edited the Link file it said “incomplete last line” on opening the file. After editing and saving I predictably got all sorts of errors.

Note I just removed a couple additional hue bulbs and this time I know I deleted the item, but PaperUI re-loaded after I hit the trash can next to the item and the item was back without a trash can. What is going on?

Always remove the Link before removing the Item. There is apparently a problem in PaperUI that is leaving the Link. As long as the Item appears in the Link file it will appear in the Item list.

Then you accidentally deleted something you shouldn’t have, or you failed to delete the entire entry.

If you look at my example above, everything you see there needs to be deleted, but no more than what you see. If the entry is the very last one in the file, there will not be a comma at the end. If you deleted the last entry in the file, you need to delete the comma on from the entry before.

The very last character of the file will be a } on one line all by itself.

What said incomplete last line? Did you follow the steps exactly (i.e. only edit the file when OH is not running).

What does this mean? I thought the item in the PaperUI was the link. There is no section in PaperUI for links. I deleted the item first, then the thing. Is there something else I should have done first?

I don’t think so. I think it’s related to the “incomplete last line” message I got when I opened the file for editing.

I deleted everything as you specified. The last line had a } by itself on the line.

My editor (vi) is what said that, on the status line, at the bottom of the terminal window. OH was not running.

Before you delete a Thing, go to all of the Channels and remove any Links to Items before deleting the Thing. Otherwise you end up with orphaned Links.

After getting the errors, did you follow the instructions and restore the backup and try the edit again? If so you may need to go back to at least one version further back. You should have at least five versions of that file in backup.

I restored the file and everything worked fine. I haven’t edited it again yet - trying a different editor in case vi doesn’t interpret newlines the same way…

vi should be fine. The problem may have been the file was corrupted to begin with.

I edited it with the visual editor in ubuntu (opened the folder in file system explorer and double clicked it) and everything worked fine.