Issues connecting a v3 Aqara/Xiaomi gateway via Homekit that had previously been working fine

Having issues connecting my Xiaomi/Aqara Hub/Bridge thing. I’ve had Xiaomi hubs working for years on Home Assistant with a variety of sensors and switches, but recently had to reset my current v3 Aqara hub when I changed my wifi settings, and everything has gone pear-shaped.

Everything seemed to be working apart from no longer being able to turn the Xiaomi power points on and off via HA (everything is fine using the Mi Home app), but multiple restarts of all associated items (bridge/power points/HA) couldn’t bring them up, so I decided to remove the hub from HA and start again, only to find that it can’t be re-added.

I’m currently using the v3 hub, which was previously connected via the HomeKit integration, but no matter what I do I can’t get HA to recognise it again. I restart HA and go to add the Homekit Controller integration, but the Xiaomi gateway never appears as an option (despite multiple restarts of HA and several resets of the gateway). Thought I had cracked it when I spotted that “discovery” was hashed out in my configuration.yaml, but that made no difference.

It’s weird, because the gateway can obviously connect to HA (before I deleted it earlier today it was correctly showing sensor readings, just not controlling the power switches). Is there some residual HA assistant files/settings that I need to purge? Or is there some setting in the MiHome app I have missed? Or is it related to this post and HA simply doesn’t work with the hub any more?

EDIT: Got a previous version hub out of my spares pile, and managed to connect it via the “Xiaomi Gateway (Aqara)” integration with the help of an old MiHome apk to get the hidden key. That has at least given me access to the sensors again, but still can’t access the powerpoints or connect the HomeKit enabled version of the hub via HA’s homekit integration.

Looks like it is a Homekit or discovery issue: @rasmus_pl had the same issue when he tried to re-add a deleted aqara hub.

Just for other Homekit noobs: once a Homekit item is paired, it can’t be re-paired until it is fully reset. For the Aqara hub, you can’t just use the standard reset (holding down button on hub for 10 seconds), you also have to do a full reset (standard reset + 10 quick clicks on the hub button), and then the gateway is once again discoverable by Homekit.