Another post about pairing with homekit

On an RPi 3b+ with a fresh install of Stretch and after carefully following the directions to install HA in a virtualenv with autostart, the front end functions well, and my configuration.yaml passes muster. Homekit and zeroconf are active, and the RPi advertises (per Bonjour Browser) both its ethernet and wifi connections. A Nest thermostat connects and data is loaded in the front end. However, no matter what I try, iOS will not see the home assistant to add it to homekit (spinning wheel that eventually doesnā€™t find anything). The only error in home-assistant.log is that notify.ios has no loaded devices. Autodiscovery through the Home Assistant iOS app also doesnā€™t work.

Have tried all of the following: deleted .homekit.state; tried adding from the home app on idevices running iOS 11.4, 11.4.1, and 12.0 beta 10; reloaded Home Assist 0.77.3 and all required dependencies several times; upgraded to 0.78.0b1. Still no luck.

I have a feeling that iā€™m missing something simpleā€¦ thoughts? Thanks in advance everyone.

Anyone? Iā€™m still stuck

Just making sure, but you have the homekit component loaded and not the homekit controller component correct?

I"m having this same trouble, Iā€™m running Hass.io, and I get the Homekit code in HA, I see Home assistant, enter into the code into my iPhone, it spins for awhile and then says ā€œcouldnā€™t add home assistant bridgeā€. Then I delete .homekit.state and try again and again, always the same thing.

I will note that I have VLANs on my network,but the iPhone and the Hass.IO instance are in the same VLAN.

Iā€™m running 0.78.3 BTWā€¦ and have tried pairing about 6-8 times, with 2 different Pis (Dev and Prod)ā€¦

Itā€™s so frustrating to see it there on my phone, have a code, and not be able to pair them!

bferrell, youā€™re getting farther than I am; I never see the bridge to begin with. Iā€™ve now upgraded to 0.79.1 with no changes. There are a few posts about replacing the accessory_driver.py file like this one (scroll down about half way); Iā€™m going to try this next and will report back if it works:
https://github.com/home-assistant/home-assistant/issues/14567

klm, hereā€™s my config. Is something amiss?

homeassistant:
  name: Home
  latitude: 40.72
  longitude: -74
  elevation: 10
  unit_system: imperial
  time_zone: America/New_York
  customize: !include customize.yaml

introduction:

frontend:

config:

updater:

discovery:
  enable:
    - homekit

conversation:

history:

logbook:

map:

sun:

sensor:
  - platform: yr

tts:
  - platform: google

cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

logger:
  default: warning
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug

nest:
  client_id: xxxx
  client_secret: xxxx

homekit:

ios:

zeroconf:

So for anyone following this issueā€¦ I tried replacing the accessory_driver.py file as described in the link above, and it appears to be dated information: the HA front end stated ā€œinvalid configā€, and no pairing code was displayed. So I reinstalled HAP-python and am back where I started.

There are a number of new active entries in the GitHub issue repository describing exactly what Iā€™m facing here, so I guess I will sit back and wait for someone smarter than me to figure it out.

Update: I learned how to use wget to properly download the raw file from

https://raw.githubusercontent.com/cdce8p/HAP-python/5f6f7d4589b5a64b3159475c7701d901a7d01933/pyhap/accessory_driver.py

No more invalid config, but Iā€™m back where I startedā€¦ home app doesnā€™t see the HA bridge to add it.

@fmon Have you tried using the filter to limit the accessories that are paired?

homekit:
  filter:
    include_entities:
      - demo.demo

If this config works, the issue would be with one of your entities, which isnā€™t unusual.
You could continue to allow more and more entities (through include_entities or include_domains) to find the one that is causing the issue.

cdc8ep, first of all, thanks for you help. You seem committed to the cause.

Unfortunately adding the filter to my config didnā€™t change anythingā€¦ I still get the endlessly spinning wheel.

Any other thoughts?

By any change, do you have a second SD card for experiments?
If so, could you try Hassbian and see if that works?

That way we could eliminate issues with your installation.

OK cdce8p, I etched an SD card with Hassbian and added only homekit: to the configuration file. The front end functioned as per usual (normally), but I still get the spinning wheel when trying to get the Home app to see the bridge. So then I added

logger:
  default: warning
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug

homekit:
  filter:
    include_entities:
      - demo.demo

Rebooted and tried several times, but no joy. So lastly I replaced accessory_driver.py as before and added back my old configuration.yaml file. Now I still get the pairing card in the front end, but thereā€™s another card titled ā€œinvalid configā€ that says that the homekit-controller could not be set up. However, the configuration.yaml passes whatever testing the front end does under the configuration -> general section. My conclusion is that the revised driver isnā€™t compatible with Hassbian??

Possibly related: throughout all of this, autodiscovery by the iOS app has failed.

Lastly: is proximity of the phone to the RPi important when trying to do any of this? Iā€™ve been holding the phone near it assuming that bluetooth may be involved, but Iā€™m not clear if this is necessary.

Strange. Can you test Hassbian with discovery disabled (also ios disabled since it would load discovery)? Maybe disable homekit-controller as well.

Iā€™m personally running Hassbian and having on issues, a driver problem is hence unlikely.

Proximity doesnā€™t matter, as long as youā€™re on the same local network during paring.

In the Home App if you click Add Accessory and Don't Have a Code or Can't Scan? do you see the Home Assistant Bridge listed there on top, or do you need to click on Manual Code -> Enter code? It should be the first one else itā€™s likely a connection issue.

Ok so I cut my configuration.yaml down to just this:

homeassistant:
  name: Home
  latitude: 40.72
  longitude: -74
  elevation: 10
  unit_system: imperial
  time_zone: America/New_York

frontend:

logger:
  default: warning
  logs:
    pyhap.accessory_driver: debug

homekit: 

Still no luck. In the Home app on iOS 12.1 I have to click on manual code entry because the bridge has never appeared as a card.

This prompts me to recall that I could never get Homebridge to work either. At some point I troubleshot my router, which is new-ish, doesnā€™t have AP isolation enabled, and does appear to support mDNS; Iā€™m running a flat LAN without anything fancy going on, so Iā€™m not sure what else to consider.

Hmm. Iā€™m a bit out of options here.

The problem seems to be the discovery on the network, the way you described it. As I said earlier, normally the Home Assistant Bridge should just show up after pressing Can't Scan.

As two really long shots you could try the ip_address parameter (doc) or running $ sudo apt-get install libavahi-compat-libdnssd-dev beforehand, but I highly doubt this will resolve it. At least on Hassbian without any VPN everything is already installed or setup correctly out of the box.

Iā€™m really sorry I canā€™t help you any further with this issue :slightly_frowning_face:
Please let me know if you have any further questions though.

In case you do find a solution one day, it would be great if you could share it here. Maybe others will find it helpful later.

Hi, Guys!

I have the same issue here. :slightly_frowning_face:
My setup is:

  • Raspberry Pi 2 B
  • HassOs image
  • Home Assistant 0.79.3 (trying since 0.79.1)
  • 16Gb Kingston SD UHS-1
  • Wired network
  • iOS 12.0 on both iphone and ipad

I tried a lot of things, for example:

  • Reinstall the HassOs
  • New install on Raspbian
  • I did a factory reset on my wireless router

Any news about this issue?

Thanks in advance!

@gustavofunke Can you describe your problem a bit more, or can I assume that the Home Assistant Bridge doesnā€™t show up in the Home App like it is/was the case for @fmon?

Unfortunately no real news about it. Just one thing I took for granted. Before trying something new, make sure to do the following:

  1. Stop Home Assistant
  2. Delete the .homekit.state file
  3. Start Home Assistant

Thatā€™s necessary since HAP-python might think that itā€™s already paired if you had at least one attempt (that might have failed) and falsely saved that. Deleting .homekit.state resets that.

Also take a look at your logs with the following config:

logger:
  default: warning
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug


homekit:
  filter:
    include_entities:
      - demo.demo

You can post them here as well if you want.

Hi, cdce8p!
My issue is the same of @fmon. The Home Assistant Bridge doesnt show up in Home app.

I tried a lot of thingsā€¦ but no solution. :frowning:

I just tried your hint, but no sucess too. :frowning:

The log is:
2018-10-11 22:55:57 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.

2018-10-11 22:55:57 WARNING (MainThread) [homeassistant.setup] Setup of frontend is taking over 10 seconds.

2018-10-11 22:56:02 DEBUG (MainThread) [homeassistant.components.homekit] Begin setup HomeKit

2018-10-11 22:56:06 ERROR (MainThread) [homeassistant.components.device_tracker] Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml

2018-10-11 22:56:10 ERROR (SyncWorker_15) [homeassistant.components.notify.ios] The notify.ios platform was loaded but no devices exist! Please check the documentation at https://home-assistant.io/ecosystem/ios/notifications/ for more information

2018-10-11 22:56:12 DEBUG (SyncWorker_7) [pyhap.characteristic] set_value: Name to Home Assistant Bridge

2018-10-11 22:56:12 DEBUG (SyncWorker_7) [pyhap.characteristic] set_value: SerialNumber to default

2018-10-11 22:56:12 DEBUG (SyncWorker_7) [pyhap.characteristic] set_value: FirmwareRevision to 0.79.3

2018-10-11 22:56:12 DEBUG (SyncWorker_7) [pyhap.characteristic] set_value: Manufacturer to Home Assistant

2018-10-11 22:56:12 DEBUG (SyncWorker_7) [pyhap.characteristic] set_value: Model to Bridge

2018-10-11 22:56:12 DEBUG (SyncWorker_7) [pyhap.characteristic] set_value: SerialNumber to homekit.bridge

2018-10-11 22:56:12 WARNING (MainThread) [homeassistant.setup] Setup of neato is taking over 10 seconds.

2018-10-11 22:56:16 ERROR (SyncWorker_13) [homeassistant.components.light.yeelight] Failed to connect to bulb x.x.x.x, Entrada: A socket error occurred when sending the command.

2018-10-11 22:56:16 WARNING (MainThread) [homeassistant.components.light] Setup of platform yeelight is taking over 10 seconds.

2018-10-11 22:56:21 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

2018-10-11 22:56:22 INFO (SyncWorker_4) [pyhap.accessory_driver] Storing Accessory state in /config/.homekit.state

2018-10-11 22:56:22 INFO (SyncWorker_4) [homeassistant.components.homekit.util] Pincode: 116-36-973

2018-10-11 22:56:22 DEBUG (SyncWorker_4) [homeassistant.components.homekit] Driver start

2018-10-11 22:56:22 INFO (SyncWorker_14) [pyhap.accessory_driver] Starting the event loop

2018-10-11 22:56:22 INFO (SyncWorker_0) [pyhap.accessory_driver] Starting accessory Home Assistant Bridge on address x.x.x.x, port 51827.

2018-10-11 22:56:23 DEBUG (SyncWorker_0) [pyhap.accessory_driver] AccessoryDriver started successfully

2018-10-11 23:05:46 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

2018-10-11 23:06:15 WARNING (SyncWorker_19) [homeassistant.components.switch.neato] Neato connection error: 404 Client Error: Not Found for url: xxx//nucleo.neatocloud.com/vendors/neato/robots/xxx

2018-10-11 23:06:16 WARNING (SyncWorker_10) [homeassistant.components.vacuum.neato] Neato connection error: 404 Client Error: Not Found for url: xxx//nucleo.neatocloud.com/vendors/neato/robots/xxx

2018-10-11 23:06:17 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved

Traceback (most recent call last):

File ā€œ/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.pyā€, line 241, in async_update_ha_state

attr = self.state_attributes or {}

File ā€œ/usr/local/lib/python3.6/site-packages/homeassistant/components/vacuum/init.pyā€, line 435, in state_attributes

if self.battery_level is not None:

File ā€œ/usr/local/lib/python3.6/site-packages/homeassistant/components/vacuum/neato.pyā€, line 143, in battery_level

return self._state[ā€˜detailsā€™][ā€˜chargeā€™]

TypeError: ā€˜NoneTypeā€™ object is not subscriptable

Do I need config some port forward on my router?

There are another configuration needed on docker? I am using HassOs Image. And I tried to install 3 times, but always have same bad result. :frowning:

I read some information about Docker network_mode hostā€¦ I dont know what is this yet. But do you think it is a hint?

PS: I didnt edit docker config yet. It is unchanged like the original hassos image.

As expected the your log doesnā€™t show anything unusual regarding HomeKit.

Router: Port forwarding shouldnā€™t be necessary. Important is that youā€™re on the same local network when trying to pair.

Docker: Unfortunately I havenā€™t use it up till now, so my knowledge about that is limited, but I have read about setting the network_mode before in this context. It seems to have helped.

Iā€™m best familiar with Hassbian. If by any chance you have a free Raspberry, you could try that. At least in my case I know that it didnā€™t require any specific parameters to be set for me to work. Thatā€™s why Iā€™m recommending it for testing.

Gentlemen- successā€¦

I was ready to start trying new routers. But first, I restored the RPi micro SD card back to its state running HA in a venv from a clone on my laptop (I had wiped it to install Hass.io as suggested earlier in this string by cdce8p). Imagine my surprise when I opened the add accessory dialog in the Home app and there was the HA bridge. Iā€™ve now successfully added it. I did NOT intentionally update anything; my HA instance is still on 0.79.3. No idea what made the difference. Interestingly, several things that werenā€™t present before now show up in the HA front end (idevices switches, ATV4 listed as ā€œremoteā€), and for the first time the HA iOS app autodiscovers HA.

Now on to figure out how to finally tell Siri to change the temp on my Nestā€¦ woohoo!! Thanks again for the help cdce8p!!!