Unable to completely remove Homekit

I need to remove an old Homekit config (after migrating to new hardware) but am unable to do so.

If I completely remove ‘homekit:’ from config.yaml everything works and Homekit is discovered. I can go through the QR code etc and everything works as expected. It adds hundreds of entities to my home app. On the integrations page it looks like this: https://i.imgur.com/XNZXMbO.png

This works but isn’t ideal, there are hundreds of entities I don’t want to appear in Home app. I need to use yaml setup so I can filter things.

But if I delete the integration, delete homkit.xxx.state (from .storage) and restart the procedure with ‘homekit:’ in yaml it doesn’t work. No QR code, no setup process, no entities in home app. The integrations page looks like this: https://i.imgur.com/WWLx7Fa.png

I don’t know why the port numbers are different. I’ve tried changing the port in yaml to match the discovery port, but no dfifference.

I’ve enabled Homekit error logs, when I setup via yaml it says this:

 [homeassistant.components.homekit] Begin setup HomeKit for HAsystem
 [homeassistant.components.homekit] Migrating legacy HomeKit data for HAsystem

Where is this ‘legacy data’ coming from? I’ve deleted homekit.xxx.states dozens of times now. Is there something else I need to delete?

I just had this happen to me. I was able to go to Developer Tools > Services > homekit.start and it produced the QR that I needed.

Hope that helps

Thanks for that but I don’t think we’re having the same problem. If I setup via yaml the HA bridge device isn’t created (as seen in my two screenshots). Instead it does this ‘migrating legacy Homekit data’ thing.

If I setup via discovery everything works, but using the filter in this mode is really slow.

I fixed this somehow, but I don’t know how.

I spent days trying to figure out where ‘migrating legacy Homekit data’ was coming from but couldn’t. In the end I took a VirtualBox snapshot and then erased everything in the /config folder and started a new HA install. This time I installed Homekit first, and it worked as normal.

I then restored my snapshot … and Homekit yaml mode works again! No more ‘migrating legacy Homekit data’ problem.