Sensors are not deleted in zll.db when deleting a device

It seems that associated sensors in table “sensors” are not always deleted when you delete device from REST-API (but device is deleted in “devices” table)

Then when re-adding device later it sometimes comes with old sensors that perhaps didn’t exist anymore (after modifiying DFF for instance).

This can be seen by executing “SELECT COUNT(SUBSTR(uniqueid,1,23)) from sensors WHERE not exists (select null from devices where mac = SUBSTR(uniqueid,1,23))” after deleting a device. This command does return lines of sensors without devices.

Ha nice I m perhaps on the same issue ATM, you have visibles effects ? If I m right you already have older device that come back ?

On my side I have someone with a recent deconz version, and the DDF generate 2 devices, the legacy one and the DDF one, if he try to delete one, both are deleted, but at next inclusion both are back (nothing to see with the FF endpoint issue)

That exactly the behavior I could see. I had a device which I thought that EP was -01, before I realized that the correct endpoint was -19. I corrected the DDF but in the meantime and -FF EP was created.

Even after upgrade of DeConz (correcting the -FF EP appearence), sometimes, after some restarts the -FF EP sensors reappeared until I saw in the DB that old -01 and -FF EP was still present in the “sensors” table.

Now that I deleted this line in “sensors” table all is fine regarding this sensors and no more ghost EP.