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