home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.61k stars 30.37k forks source link

Unable to add HomeKit bridge, "Unable to Add Accessory" "HMFErrorDomain : 2" #80862

Closed deviantintegral closed 1 year ago

deviantintegral commented 1 year ago

The problem

I noticed that all of my Home Assistant entities were showing up as "no response" in the Home app. After some troubleshooting, I decided to delete the bridge and integration configuration and start over.

When attempting to add the bridge after scanning the QR code, I get a dialog with "Unable to Add Accessory", "Unknown Error Code: HMFErrorDomain : 2".

IMG_B7BB1D8DC33E-1

I get the same error attempting to pair with my iPhone running iOS 16 and my iPad running iPadOS 15.6. As well, I get the error attempting to add the camera bridge that is also set up.

It looks like Home Assistant thinks it's paired with a debug log like:

2022-10-23 22:22:50.130 INFO (MainThread) [pyhap.accessory_driver] Paired with 2dc9234b-ede7-4845-ad4b-edbd37c1a354 with permissions b'\x01'.

There's no errors in the logs either, however at the end there's:

2022-10-23 22:22:50.727 DEBUG (MainThread) [pyhap.hap_protocol] ('192.168.2.20', 62873) (8a814f83-e96b-4bc9-850a-fcb136ec7478): Connection lost to Midland Radar: None

What version of Home Assistant Core has the issue?

core-2022.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeKit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

https://gist.github.com/deviantintegral/c3dd6ac60374f9aecefbb2f855617626

Additional information

I'm not an owner, but an administrator of the home so I can still add accessories.

The AppleTV acting as a home hub is on tvOS 15.6. I don't know what iOS version the home owner is on.

home-assistant[bot] commented 1 year ago

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `homekit` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant unassign homekit` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit documentation homekit source (message by IssueLinks)

deviantintegral commented 1 year ago

I've confirmed I get the same error with the example testing config from the docs:

homekit:
  filter:
    include_entities:
      - demo.demo

Here's the debug logs while trying to add the bridge with the demo entity:

https://gist.github.com/deviantintegral/c3dd6ac60374f9aecefbb2f855617626

bdraco commented 1 year ago

Unknown Error Code: HMFErrorDomain : 2 isn't much to go on and the hap transition you posted looks ok.

Some times signing out of iCloud , rebooting, and signing into iCloud on the device can correct unexpected errors.

deviantintegral commented 1 year ago

I tried signing out and in to iCloud on my iPad, and oddly the removed HASS bridge showed back up. It certainly has me thinking something is awry with the HomeKit data itself.

Another possible issue - how dependent is HomeKit accessory pairing on IPv6? Earlier, the ISP-provided router was issuing IPv6 addresses, but no routes to the internet as the uplink still doesn't support IPv6. I noticed yesterday that it's no longer issuing IPv6 addresses, which overall is probably good since some apps had lag until they realized IPv6 wasn't functional.

I'm no longer on site and won't be a for a while. I thought perhaps I could continue testing with TailScale, but Home is now hanging at an earlier step trying to connect to the bridge. Unless there's a way to set up a new accessory remotely, I may be stuck on this.

bdraco commented 1 year ago

Another possible issue - how dependent is HomeKit accessory pairing on IPv6? Earlier, the ISP-provided router was issuing IPv6 addresses, but no routes to the internet as the uplink still doesn't support IPv6. I noticed yesterday that it's no longer issuing IPv6 addresses, which overall is probably good since some apps had lag until they realized IPv6 wasn't functional.

Its probably connecting over IPv4, but you'd have to check the mdns announcement to be sure.

https://apps.apple.com/us/app/discovery-dns-sd-browser/id1381004916?mt=12

I'm no longer on site and won't be a for a while. I thought perhaps I could continue testing with TailScale, but Home is now hanging at an earlier step trying to connect to the bridge. Unless there's a way to set up a new accessory remotely, I may be stuck on this.

You have to be local to pair with iOS sans some vpn magic which probably isn't recommended

KmanOz commented 1 year ago

Hi just want to confirm the same happening here. I just happened to commission a new install just as the 2022.10.5 was released. I can confirm that I to have the same issue. Checking Discovery tool on OSX nothing appears in _hap_tcp or _homekit_tcp sections either.

I can confirm something else that may or may not be adding to the issue. zeroconf does not work and neither does my Xiaomi Aqara integration. I had to add everything manually as nothing was discovered.

KmanOz commented 1 year ago

Im not sure if this is going to help someone but I run HomeAssistant in docker. It seems I setup HASS as a bridge network rather than a host on my new install. Once I changed it back to host, everything started working normally including zeroconf and HomeKit.

deviantintegral commented 1 year ago

The other HomeKit admin got this working, but I wasn't there so I don't have full details or debug logs.

So, the obvious interpretation is that somehow by a bug or user error a whole new HomeKit home got created. But if that was the case, then why did the bridged camera entity work in both, without being re-added to the "second" home"? 🤷

I think it's safe to say in my case, networking had nothing to do with it. I'd guess either something with the iOS 16 rewrite, or the fact that I'm an "admin" but not the owner of the home.

I think if there's no more reports of this in the next 2-4 weeks we can close this, as neither fix was due to any changes in HA itself.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.