Add ability to manually merge duplicate devices

It is not uncommon for the same device to have more than one integration providing data about it. This is particularly common with network based tracking integrations (e.g. the unifi or nmap integrations) as they create a device_tracker for every device on the network (with some filtering) including any wifi based smart devices already linked with Home Assistant via their own integration.

This creates duplicate devices, one with the device_tracker and one with the rest of the data from that device (e.g. Imgur: The magic of the Internet). This can make managing them a pain as they will have different IDs depending on what sensor you want to access.

There are some devices that do get merged into a single device (e.g. Imgur: The magic of the Internet) and they are much easier to manage. As it is I can not work out what is different about these devices that tells HA to merge them, but I suspect it is using the MAC address.

On solution would be to update all the integrations that don’t merge devices so that they provide HA the correct info to do it automatically, but a better and easier option is to add a feature to HA that lets the user manually merge devices. This would have the added benefit of allowing the merging of different devices that are only used together (e.g. a smart switch on a smart device with no power control) into a single device that can be managed more easily.

They probably have matching identifier (Mac address you already mentioned).

Every device can have multiple identifiers see Device Registry | Home Assistant Developer Docs

Seems that you should ask the integration author (if it’s a custom integration) to add some common identifier so HA can correctly merge the device

i agree that asking the integration author to fix it would be one solution but i don’t think it is a practical one. i have at least 4 integrations that don’t work and i have a very small setup compared to others i have seen. i would imagine that there are lots of integrations that do not handle this correctly. that is why i am proposing a fix that tackles it at the HA level so that it can be solved for all integrations at once. especially for ones with no active development or that can not access the required information from the device itself.

4 Likes

I would also like to see this capability added. This has already been suggested in the developer doc for the device registry:

Although not currently available, we could consider offering an option to users to merge devices.

I don’t see an open Github issue though. As far as what HA is using to automatically combine duplicates, it is explained on that same page:

A device will be matched up with an existing device via supplied identifiers or connections, like serial numbers or MAC addresses. If identifiers and connections are provided, the device registry will first try to match by identifiers. Each identifier and each connection is matched individually (e.g. only one connection needs to match to be considered the same device).

6 Likes

Is there still no way to merge devices? For example the App doesn’t provide the mac address of the device (at least in my case) so it can’t be automatically merged with the device tracker.

1 Like

Hello there, I created a custom integration that allows the user to merge and modify devices and assign loose entities to a device. Currently merging works by assigning all entities of child devices to a parent device, but I want to try using connections or identifiers for a smoother solution in the future.

Perhaps you’d like to check it out: Device Tools: Create, Modify and Merge Devices

1 Like

Very interesting! It sounds like this could be also used to attach more entities to a “merged” device as requested here? Add Template Sensors to Device page