How to remove things when device is gone

I have ended up with some ‘things’ that I no longer have. When I select the device and choose delete. It sits saying removing but is never actually removed.

How can I get rid of these ‘phantom’ things?

Is this on PaperUI? What version of openHAB?

I sometimes see the same thing, but a refresh of the PaperUI (as in, press F5) usually fixes it.

Presumably the Things you’re trying to delete where created in PaperUI in the first place? If they were from config files then they can’t be deleted from PaperUI.

In PaperUI, clicking remove twice will force remove it as far as I remember. That did the trick for me a lot of times!

You are assuming openHAB2.The version was not specified :wink:

Connect to your openhab server using ssh or if you’re already on the terminal you can directly open the openhab console.

openhab-cli console

Use “habopen” when prompted for the password and you haven’t changed it.

Then list your things with

openhab:things list

And then remove your things with:

openhab:things remove <thingUID>

<thingUID> = first part until space from previous list

This should work no mater if it is openhab 2 or 3.

2 Likes

Thanks everyone for replying.

Apologies for the woeful details I provided. I’m using OH3

ahem - how do I get there with a docker install on a synology NAS? When SSH to synology i get a “openhab-cli: command not found” :roll_eyes:

You have to get into the docker container or execute the command inside the container.

  1. Use docker ps to get the name of the existing container
  2. Use the command docker exec -it <container name> /bin/bash to get a bash shell in the container
  3. Generically, use docker exec -it <container name> <command> to execute whatever command you specify in the container.
    Source

Something like docker exec -it my-openhab3-container openhab-cli console should bring up the openhab console.

Mmh, i’m afraid this don’t work - here’s my result:

Openhabian@OHonSyno:~$ sudo docker exec -it myOpenhab3 /bin/bash
root@myOpenhab3:/openhab# openhab:things list
bash: openhab:things: command not found
root@myOpenhab3:/openhab#

what I also really don’t understand is that I can’t find anything in the created folders:

root@ myOpenhab3:/openhab# cd conf
root@ myOpenhab3:/openhab/conf# cd things
root@ myOpenhab3:/openhab/conf/things# dir
readme.txt
root@ myOpenhab3:/openhab/conf/things#

…but I have created about 20 (working) things via the GUI.

…but I have created about 20 (working) things via the GUI.

The things created by the ui are not stored under those folders. They are located in files under /var/lib/openhab/jsondb. You shouldn’t edit them until you know what your’re doing.

Mmh, i’m afraid this don’t work - here’s my result:

You have to open the openhab-cli console first.

Try to execute:
openhab-cli console
inside the container.

login with habopen and then you can use openhab:things list command.

Mmmh, where ist my mistake … i’ve walked this ways:

login as: openhabian
openhabian@192.168.0.277’s password:

Openhabian@OHonSyno:~$ openhab-cli console
-sh: openhab-cli: command not found
Openhabian@OHonSyno:~$ sudo openhab-cli console
Password:
sudo: openhab-cli: command not found

==> o.k. - sure, this can’t work, cause im only SSH in the Synology itself … but next i’ve tried this:

Openhabian@OHonSyno:~$ sudo docker exec -it myOpenhab3 /bin/bash

==> i think i’ "in "the container now … but still:

root@myOpenhab3:/openhab# openhab-cli console
bash: openhab-cli: command not found
root@myOpenhab3:/openhab# sudo openhab-cli console
bash: sudo: command not found
root@myOpenhab3:/openhab#

Maybe i’ve set another Adminuser (“openhabian” - i know - that’s not so suitable) in the Synology …?

Yikes! This looks really scary to me as a user of the GUI version of OH3.

Guess what? All you have to do is go through the delete process twice. The first time it gets stuck and says “Removing” but if it never goes (like for me) then just open the Thing a second time and Delete again. You get a warning message, but forcing removal in this way worked for me.

I had a load of duplicate Things appear - no idea what I did wrong. All with duplicate configuration IDs. Anyway, they’re gone, and I now have just one Thing for each … thing.

Phew!