How can I delete devices I dont want in HA?

That works only if you have a single device, when you have an integration that creates a Hub with multiple devices, and one of the devices is the one you want to delete it doesn’t work.

The only way I found is messing with the config storage, but that’s not for basic users…you risk of damaging HA configuration.

1 Like

Only a few integrations offer that.

Yes, it’s often forgotten, but possible to add the function.

I use this snippet in an integration, it enables users to delete a device from the hub at the Device info dialog using the overflow menu (three dots on top of eachother):

3 Likes

I created a PR to add this possibility for stale Unifi devices:

2 Likes

Deleting the integration and adding back in got rid of the devices I no longer use and were deleted in Smartthings.

There is the service recorder.purge_entities than can be called in Developer tools, in case of more entities switch to YAML and paste the list.

Tested on 154 orphaned entities and worked smoothly, got rid of them.

Running latest HASS@RPI5

But it can not solve my issue with tp-link router, handled by integrations “tp-link router” a “UPnP/IGD”. I replaced old VR2100 by AX55 Pro but old one is still in “tp-link router” integration. I can delete also this integration but I don’t want to loose all devices and related entities of “device_tracker” domain, including history.

Thank you!
This code helps me with hass-victron integration. I just placed this code in __init__.py in the integration folder

Code not in image format :upside_down_face:

async def async_remove_config_entry_device(hass, config, device_entry) -> bool:
    if device_entry is not None:
        # Notify the user that the device has been removed
        hass.components.persistent_notification.async_create(
            f"The following device was removed from the system: {device_entry}",
            title="Device Removed",
        )
        return True
    else:
        return False