agittins / bermuda

Bermuda Bluetooth/BLE Triangulation / Trilateration for HomeAssistant
MIT License
637 stars 17 forks source link

Deleting a device does not fully remove it #340

Closed talormanda closed 1 week ago

talormanda commented 4 weeks ago

Configuration

image

Describe the bug

I added a device, removed it, restarted. It still shows there are 2 devices, yet only one is configured. Visiting the device, all the sensors it created are still there, but marked "unavailable".

Diagnostics

config_entry-bermuda-01JB73J0XCQ8R4BN0JZ10J4B1A.json

agittins commented 4 weeks ago

Yes, I think this is normal? Bermuda is no longer creating the device at start-up, but HA is restoring it when it starts up. After some period of time (minutes?) HA will decide that Bermuda is no longer creating those entities, and will let you delete them.

I am wondering though if maybe Bermuda should be deleting them... but I suspect not, since deleting/recreating a device is something one might want to do without having all the old history deleted in the process. Maybe there's a best-practice guide on that somewhere...

talormanda commented 4 weeks ago

Yes, I think this is normal? Bermuda is no longer creating the device at start-up, but HA is restoring it when it starts up. After some period of time (minutes?) HA will decide that Bermuda is no longer creating those entities, and will let you delete them.

I am wondering though if maybe Bermuda should be deleting them... but I suspect not, since deleting/recreating a device is something one might want to do without having all the old history deleted in the process. Maybe there's a best-practice guide on that somewhere...

I figured it would at least remove the sensors it created, because when I go and look at the integration, it says there are "2" devices. And the one I deleted is still counted, when I believe it really shouldn't be. On top of that, I have to now go in and manually delete 10+ sensors that are disabled / unavailable. Not very fun!

agittins commented 3 weeks ago

I agree that it's not a great experience!

Does this not work for you? There's a hidden option on the device page (but they don't seem to expose it on the device list ui): image

talormanda commented 3 weeks ago

Mine didnt exactly look like that because it merged onto another device page. I had picked my switchbot curtain, so it merged bermuda sensors onto the switchbot ones. I can try cloning my VM and testing to see if that option pops up later tonight. (I just dont want to really delete / re-add over and over)

agittins commented 3 weeks ago

Multi-integration devices should still work, the delete option changes depending on which path you came to the device through:

image

The main problem I think is that this option is just not very visible, and if you don't know to look for it one would never find it, since you can delete other stuff like entities OK, except for the disabled ones... it's confusing.

Oh, also - if HA hasn't been restarted since the device was removed from Bermuda (or any other integration), it may not show the device as being able to be removed, and the delete option won't appear. It's doubly-frustrating!

talormanda commented 3 weeks ago

It's possible that is all it is, I will check.

agittins commented 1 week ago

Hi @talormanda, I've just released v0.7.1 of Bermuda, and it includes some significant improvements in handling scanners coming and going. During part of my testing I disabled ble scanning on an esphome, and when it rebooted the associated entities seemed to deactivate in the way one would expect.

Since I think we covered most of your original issue, plus perhaps some extra improved functionality in the latest release, I'll close this issue, but please feel free to re-open if you find anything going on in the same vein.

Thanks for your report and follow-up!

talormanda commented 1 week ago

Sounds good thanks.