Support for control of HomeKit bulbs and switches (testing required!)

Anyone have any success installing on Mac OS 10.11.x? I am running into issues with the dependencies it would seem. Specifically I can’t get or find py25519.

The error I am getting is "Unable to install HomeKit==0.6: failed building wheel for py25519

Thanks!

I’m surprised that the latest homeassistant/home-assistant docker image still does not have gmpy2 installed. I was able to manually run the following in the docker container and it works.

sudo docker exec -i -t home-assistant bash
pip install gmpy2

But I’m hesitant to implement it because it will stop working when I update Home Assistant. Unless there is a way to run ‘pip install gmpy2’ in docker-compose.yaml whenever the image is updated?

Error log:

2018-05-14 16:26:34 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 243, in discovery_dispatch
    device = HKDevice(hass, host, port, model, hkid, config_num, config)
  File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 73, in __init__
    import homekit
  File "/config/deps/lib/python3.6/site-packages/homekit/__init__.py", line 23, in <module>
    from homekit.protocol import perform_pair_setup, get_session_keys
  File "/config/deps/lib/python3.6/site-packages/homekit/protocol.py", line 25, in <module>
    from homekit.srp import SrpClient
  File "/config/deps/lib/python3.6/site-packages/homekit/srp.py", line 25, in <module>
    import gmpy2
ModuleNotFoundError: No module named 'gmpy2'
2018-05-14 16:26:34 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 243, in discovery_dispatch
    device = HKDevice(hass, host, port, model, hkid, config_num, config)
  File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 90, in __init__
    self.pairing_data = homekit.load_pairing(self.pairing_file)
    AttributeError: module 'homekit' has no attribute 'load_pairing'

Hey amdc7

I’m having the exact same issue - I have tried so many different things, even a totally clean MacOS install in case I had messed up some earlier dependencies.

The new home-controller feature is an excellent feature that finally allows me to bring all of my devices together. I’m super keen to get it working if anybody can help.

I receive these very long and complicated looking logs

Not initializing homekit_controller because could not install requirement homekit==0.6

and…

Unable to install package homekit==0.6: Failed building wheel for py25519
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you’ll have pycryptodome 3.4.11 which is incompatible.
pyatv 0.3.9 has requirement aiohttp<3,>=2.3.0, but you’ll have aiohttp 3.1.3 which is incompatible.
Command “/usr/local/opt/python/bin/python3.6 -u -c “import setuptools, tokenize;file=’/private/var/folders/x6/16l59g4x26l4q9fq787jvmy40000gn/T/pip-install-4z15brmh/py25519/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /private/var/folders/x6/16l59g4x26l4q9fq787jvmy40000gn/T/pip-record-yq3qhsp2/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /private/var/folders/x6/16l59g4x26l4q9fq787jvmy40000gn/T/pip-install-4z15brmh/py25519/

Thanks, Drew

hi there,
i have tried this component. I’ve tried to connect my Kogeek switched to home-assistant. But it only works when i completely reset the switch and remove from iOS Home app and then connect to home-assistant. I was wondering if this can be by-passed and be added to home-assistant despite the switch added to Home app ?

No. From the docs:

Note that HomeKit accessories can only be paired to one device at once. If your device is currently paired with Siri, you will need to reset it in order to pair it with Home Assistant. Once Home Assistant is configured to work with the device, you can export it back to Siri with the HomeKit component

I manually pulled homeassistant/home-assistant:latest, this fixed the issue for me.

Sorry for the delay… had a death in the family and show all around stuff that prevented me from getting back.

I ended up totally giving up on this on my Mac. Last night I setup a new headless Ubuntu server, and will be moving over my Home Assistant install tonight. I don’t expect any issues like this on that platform, as most of the libraries required for this to work, are available to Ubuntu. I wish that the Mac was able to do this, but you win some… and you lose some!

Best of luck, but I would encourage you to at least consider running a VM with either CentOS or Ubuntu in order to accomplish this.

I was able to add my light into homeassistant, but i never see the entity and when i look in the logs i see this…

2018-06-12 09:34:24 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/adrian/homeassistant/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 243, in discovery_dispatch
    device = HKDevice(hass, host, port, model, hkid, config_num, config)
  File "/home/adrian/homeassistant/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 98, in __init__
    self.accessory_setup()
  File "/home/adrian/homeassistant/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 107, in accessory_setup
    homekit.get_session_keys(self.conn, self.pairing_data)
  File "/home/adrian/homeassistant/lib/python3.6/site-packages/homekit/protocol.py", line 292, in get_session_keys
    resp = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

Hey,

Don’t know if you figure this one out already but if the following seem to help getting past “this device is already associated” error

  1. Go through pairing steps on IOS device (i.e. press top paddle -> solid amber -> blinking red/amber -> release paddle -> blinking green -> pair via HomeKit)
  2. Remove device in home kit (Press and hold -> Details -> remove). After I do this step I’m able to register devices in Home Assistant.

One caveat though - I have 1 Dimmer (Leviton DH6HD) and 3 of Leviton DH15S-1BZ. Dimmer appears in the UI right away and I’m able to control the lights via it. The switches on the other hand disappear and are nowhere to be found in HA, even though I see the respective HK registration/linking details under .homekit folder. Wondering if anyone else is having his issue? Am I missing a step?

This is what i see in the log. Two switches and dimmer are found but only dimmer shows up in UI. (note you only see two switches, not three like in my original reply - the third one is currently offline)

root@raspberrypi:/home/homeassistant/.homeassistant# grep homekit home-assistant.log
2018-08-10 15:05:19 DEBUG (Thread-19) [homeassistant.components.homekit_controller] Discovered unique device E3:CE:C0:XX:XX:XX
2018-08-10 15:05:19 DEBUG (Thread-6) [homeassistant.components.homekit_controller] Discovered unique device 2C:13:BF:XX:XX:XX
2018-08-10 15:05:19 DEBUG (Thread-10) [homeassistant.components.homekit_controller] Discovered unique device 35:F5:F2:XX:XX:XX
2018-08-10 15:05:21 INFO (Thread-19) [homeassistant.components.homekit_controller] Setting up Homekit device Leviton Switch-068AC0
2018-08-10 15:05:21 INFO (Thread-6) [homeassistant.components.homekit_controller] Setting up Homekit device Leviton Switch-068A85
2018-08-10 15:05:21 INFO (Thread-10) [homeassistant.components.homekit_controller] Setting up Homekit device Leviton Dimmer-066B62
2018-08-10 15:05:22 DEBUG (Thread-6) [homeassistant.components.homekit_controller] Found accessory-information
2018-08-10 15:05:22 DEBUG (Thread-6) [homeassistant.components.homekit_controller] Found Unknown Service: A2
2018-08-10 15:05:22 DEBUG (Thread-6) [homeassistant.components.homekit_controller] Found switch
2018-08-10 15:05:22 DEBUG (Thread-6) [homeassistant.components.homekit_controller] Found Unknown Service: 01b6f2ca-827a-11e5-8bcf-xxxxxxx
2018-08-10 15:05:22 DEBUG (Thread-19) [homeassistant.components.homekit_controller] Found accessory-information
2018-08-10 15:05:22 DEBUG (Thread-19) [homeassistant.components.homekit_controller] Found Unknown Service: A2
2018-08-10 15:05:22 DEBUG (Thread-19) [homeassistant.components.homekit_controller] Found switch
2018-08-10 15:05:23 DEBUG (Thread-19) [homeassistant.components.homekit_controller] Found Unknown Service: 01b6f2ca-827a-11e5-8bcf-xxxxxxx
2018-08-10 15:05:23 DEBUG (Thread-10) [homeassistant.components.homekit_controller] Found accessory-information
2018-08-10 15:05:23 DEBUG (Thread-10) [homeassistant.components.homekit_controller] Found Unknown Service: A2
2018-08-10 15:05:23 DEBUG (Thread-10) [homeassistant.components.homekit_controller] Found lightbulb
2018-08-10 15:05:23 DEBUG (Thread-10) [homeassistant.components.homekit_controller] Found Unknown Service: 01b6f2ca-827a-11e5-8bcf-xxxxxxx

Note I XX’d out MAC address and Service ID. MAC addresses are different but Service ID in all three cases is the same number where xxxxx is. Maybe that matters?

Koogeek Dimmable Smart LED Light Strip - Working , Thanks

Thanks in advance

Hello all,
First time poster and general newbie to Home Assistant. I’m having some similar trouble pairing a Leviton DH6HD to Home Assistant 0.77.3 running out of a virtual environment on an Rpi3b+. I presently have the bare minimum:
discovery:
enable:
- homekit
and
homekit:
filter:
include_domains:
- light
exclude_domains:
- sensor
- script
entries in my configuration.yml. The interesting problem I’ve run into is that I seem to be unable to obtain a card on the HA frontend for entering the Homekit pin code for the switch, but I do obtain a card presenting the pin code for the Homekit controller to pair with my cell. Is there something I’ve done incorrectly in the configuration? Failing automatic discovery of the switch, is there a manual method to add the light switch device and associated homekit code to my configuration.yml?

Hello again,
Took me a bit of reading through this thread and the switch manual, but I think I got this to work. Hopefully, others will find this solution useful. Firstly, if you’ve already paired the switch with your cell’s Home app, follow the instructions from the DH6HD manual to perform a factory reset. Secondly, once the switch is back in enrollment mode (blinking green light), navigate to your cell phone’s WiFi settings and select the Leviton-xxx network that appears. Thirdly, DO NOT ENTER THE HOMEKIT CODE IN THE HOME APP. Just wait for the device to join your home network (solid green light). Lastly, go to the HA frontend. A card should appear that permits configuration of the automatically detected device. Enter the homekit code in the page provided by the configuration link. Then have fun automating your lights!

Cheers,
-delV

Hello all,
I’m back again after increasing the scope of my automation project. Presently I’m having some difficulty integrating the Leviton DH15S. Presently, I can follow the steps I used for the DH6HD to obtain a configuration card on the homeassistant front-end, but after entering the homekit code, the switch state fails to appear on the overview page. Has anyone else experienced similar issues with this particular switch?

Thanks,
delV

Update on 11/17:

I second CochranCraft’s issue with the DH15S. Upgrading to 0.82.1 seems to have broken the DH6HD I had previously working in 0.77.3. This appears to be a similar issue with the configurator, please see logs below:

Error executing service <ServiceCall configurator.configure (c:7975a2a41bexxxxxxxc4c74b2fb1de0): fields=code=xxx-xx-xxx, configure_id=1796084272-2>
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py”, line 1177, in _event_to_service_call
await service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/configurator.py”, line 221, in async_handle_service_call
call.data.get(ATTR_FIELDS, {}))
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/homekit_controller/init.py”, line 214, in device_config_callback
self.accessory_setup()
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/homekit_controller/init.py”, line 136, in accessory_setup
data = self.get_json(’/accessories’)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/homekit_controller/init.py”, line 163, in get_json
response = self.securecon.get(target)
AttributeError: ‘NoneType’ object has no attribute ‘get’

Will try to reinstall the previous version until this is in better shape…

I have a problem with my HomeKit devices that I setup previously with HomeKit controller, that they’ve disappeared from Home Assistant.

I tried disabling the HomeKit controller (removing the code from HomeKit controller), then re-enabling it. But they won’t show up in Home Assistant anymore, and I can’t find a way of showing the HomeKit controller configuration to try to add them again.

Looking at the logs it shows this:

File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 258, in discovery_dispatch
    device = HKDevice(hass, host, port, model, hkid, config_num, config)
  
File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 106, in __init__
    self.accessory_setup()

File "/usr/src/app/homeassistant/components/homekit_controller/__init__.py", line 115, in accessory_setup
    homekit.get_session_keys(self.conn, self.pairing_data)

Does this reveal any problems?

Or is there any way to ‘force remove’ HomeKit controller support/devices, then add them again afterwards?

is it being worked on? is there an active project?

Hi. I´m trying to integrate Koogeek P1EU with Home Assistant, but always say that the homekit code xxx-xx-xxx is wrong. The code is ok

My Home Assistant version is 0.80.1 on PI3 (Raspbian)

Any help???

Hi could you please remove Nanoleaf Aurora it is showing as NL22, it already has a component on HASS

Home Assistant

Nanoleaf Aurora Light Panel

Instructions how to integrate Nanoleaf Aurora Light Panels into Home Assistant.

Thanks in advance

Here is what showed up in Developer tools-info after a switch (Leviton Decora Smart DH15S) was discovered and the PIN code was entered XXX-XX-XXX. I am using Raspberry Pi Docker solution Ver. 0.82.0

Sun Nov 11 2018 22:38:29 GMT-0600 (Central Standard Time)

Error executing service <ServiceCall configurator.configure (c:3a913283ffaXXXXXXX90925d04649f93): configure_id=1969136656-1, fields=code=4XX-1X-4XX>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 1177, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/configurator.py”, line 221, in async_handle_service_call
call.data.get(ATTR_FIELDS, {}))
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/init.py”, line 214, in device_config_callback
self.accessory_setup()
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/init.py”, line 136, in accessory_setup
data = self.get_json(’/accessories’)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/init.py”, line 163, in get_json
response = self.securecon.get(target)
AttributeError: ‘NoneType’ object has no attribute ‘get’

Any idea what is going on? I setup switch through iPad and DID NOT enter a PIN, it appeared to “pair” successfully with Home assistant.

Regards,
Robert

I’ve been having this same exact issue with the same exact Leviton switch. I tried to setup multiple times over the last couple of days. Even spent some time setting up a custom homekit component to try debugging but I wasnt able to get anywhere. Looks like the “securecon” object isn’t being created, which seems to come from the underlying “homekit” library.