planbnet/livisi_unofficial

Automatically remove devices that no longer exist

Closed this issue · 6 comments

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

Devices that are no longer available in the Livisi environment, for whatever reason - defective, temporarily removed to have a clean system, etc. - still appear in the HA device overview.

Describe the solution you'd like

Manual deletion.

Describe alternatives you've considered

As soon as a device is removed from the Livisi installation, it will also be removed from the HA installation or at least can be deleted.

Additional context

Nothing at the moment.

You can manually delete the entities after they have been removed from Livisi, but the device will persist and does not show the "delete" button in the UI. I have no idea how I can enable this.

I wouldn't do automatic deletion of entities, because that would mean errors on the livisi controller side can mess up the whole configuration. But you're right: there should be a way to (either automatically or manually) remove the device after all the entities have been deleted.

Devices are automatically deleted when reloading the integration if all entities have been manually removed

But for me the entities cannot be deleted at all. Delete is always grayed out. The device is no longer available in Livisi. Any tips?

Are you testing the unreleased code? The changes have not yet been released, they will be in v1.9.0

However, deleting entities should already be possible in earlier versions, if they are not listed by the controller anymore.

Ah, ok, I understood that this is already the case in the current version. Thanks.

So they are definitely no longer in the controller, even if another device with the same plain text name exists. It was, so to speak, an exchange for a defective device. But I thought the integration worked with its own internal names?

Home Assistant does both, which IMHO is great because it supports exactly your use case: Replacing a defective device. While connection to the real hardware device uses a unique id, entity names can be reused, which allows to keep statistics and automations untouched. That's why you can rename an entity in Home Assistant.
So, if you delete one device in livisi and add a new one with the same name, the integration will add the entities with "_2" in the end, because it does not know the old ones are not required anymore. But if you delete the old entities before adding the new device in livisi, it will reuse the name.
But you can always delete the unavailable devices and then rename the "_2" ones later.