Phantom devices won't go away

I have removed several ZigBee devices via the Webthings web interface - but they keep coming back when I try to add other devices. The actual devices are powered off (battery removed) and I have restarted the gateway several times (including a full power-down of the Pi). They just insist on reappearing …

Is there a hidden config file some that needs to be manually edited to clear these devices out?

I’m sure someone else knows more than I, but you may find orphaned entries in the sqlite database. There have been a few addons that don’t clean up properly requiring manual intervention.

I checked .webthings/config/db.sqlite3 and the records are not there. However, they get added (and removed) if I add/remove the devices using the web interface. I’m wondering if the ZigBee adapter needs to be reset and if it somehow has a “memory” of its own! Very strange. I’ll try a full power down and disconnect things.

FYI, I also had a phantom zigbee device. I did some experiments and found that the name of the phantom device appeared in 2 places in the .webthings directory tree:

  • in a data/zigbee-adapter/zb-*.json file
  • in the config/db.sqlite3 file

Note that the record was not active in sqlite, but the pattern was still in the file.

I tried various combinations of removing from the gateway, and/or removing from the json file (rebooting in between) to no effect. The phantom would always reappear in the gateway UI and the json file.

What did work was:

  • sudo systemctl stop webthings-gateway.service
  • remove the phantom id from the json file
  • connect to the ~/.webthings/config/db.sqlite3 database and run the VACUUM command
  • reboot for a clean startup

Yeah - it doesn’t make any sense to me either. YMMV, but I’d be interested to know if it works for you.

Last followup – when I had the phantom, I also couldn’t get “last year’s holiday” devices to be recognized. After eliminating the phantom, all those devices were immediately recognized as I expected. Yay! \o/

Excellent - the devices were indeed still registered in the JSON file. Once flushed out and after a full reboot, the next scan for new devices shows “nothing found”
image
Now I can add them back in one by one as needed.

Many thanks for this, IanB

Very sorry to inform everyone that this “featue” still exists after an upgrade to WT1.1 production. During extensive testing of the 1.1 alpha, beta, and final release, I had to add & remove devices multiple times. Removing a “thing” appears to remove the entry in the .webthings/config/db.sqlite3 database, but not in .webthings/data/zigbee-adapeter/zb-nn…nn.json file - even after a reboot (nn…nn is the ID of the ZigBee adapter). Following the procedure outlined at the top of the thread fixes things, but take care not to “break” the .json file!

1 Like

You might discover orphaned entries in the sqlite database, but I’m sure someone else knows more than I do. A couple additions require manual cleanup because they don’t function properly.