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

The Leviton app just seems to use Homekit so it uses the same pairing and WiFi sharing mechanism. Thoughts?

Is it prompting for a HomeKit passcode at any point?

Yes, just before the Homekit passcode it asks if it can have access to share WiFi, not sure if I bail out after I accept that then it’s good?

Is there maybe a way to manually dissociate with HomeKit without the device knowing?

Yes, do the wifi setup but don’t enter the passcode.

There is a way to do this, I just got to the point where I could pip3 install homekit on hass.io.

(Disclaimer: this is my first week playing with homeassistant, or docker for that matter)

  1. log in to the host device (not with the ssh add-on, which runs in its own docker container; check the methods for adding your ssh pubkey to authorized_keys then log in on port 22222)

  2. start a shell in the homeassistant container; use docker container list to get the right id, then execute

docker exec -it $CONTAINER_ID /bin/bash

  1. install dependencies

apk --no-cache install gcc python3-dev linux-headers musl-dev gmp-dev mpfr-dev mpc1-dev make

  1. install homekit

pip3 install homekit

Don’t know if it is just me, but I had to install dependencies with apk add --no-cache gcc python3-dev linux-headers musl-dev gmp-dev mpfr-dev mpc1-dev make. With that modification, everything installed fine, but I’m still getting the “Invalid Config” error after restart. Any ideas?

Yea I got the dependencies installed but when you restart HA it seems to restart the container which wipes out the changes. Its all a little bit over my head.

What’s the error in the log?

Yes installing the deps inside the container is not ideal. My PR to the main repo got merged so this should be fixed in the Docker builds moving forward, but may need to wait to a new release for Hassio.

2018-05-05 23:57:09 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2018-05-05 23:59:17 ERROR (SyncWorker_18) [homeassistant.util.package] Unable to install package homekit==0.6: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ti3ya584/cffi/
2018-05-05 23:59:17 ERROR (MainThread) [homeassistant.requirements] Not initializing homekit_controller because could not install requirement homekit==0.6
2018-05-05 23:59:17 ERROR (MainThread) [homeassistant.setup] Setup failed for homekit_controller: Could not install all requirements.

No go here, any other ideas? Is removing it from HomeKit (Home.app) not sufficient, I tried but maybe something else I am missing. It’s also odd homeassistant stays with the message of it’s already paired.

If Homeassistant says it’s paired, it’s because the device is telling us that it’s paired :slight_smile: Try resetting it, configuring it to join your wifi network again, and then adding it to Home Assistant?

Only other result I got was bad code (but the code isn’t bad because the same code works in Home.app)

I tried all the things, standing upside down on my head with one toe on the paddle switch while using my tongue to allow wifi access and my dog hitting submit in Home assistant still nothing.

If anyone reading this gets Leviton dimmers or switches to work please respond.

After the 69.0 update I was able to configure my Koogeek P1EU Plug successfully. But the Koogeek KH02CN wall switch, which is a 2-gang switch, although was added, is not appearing in entities of HA in any form. (none of both switches or as one switch)
Further I would exclude Homekit component and Homebridge-Addon from Homekit Controller discovery, since they only expose HA devices to Homekit.
(And maybe add a ignore button while configuring new devices for those ones that we dont want to be added and always being displayed on the webpage?)

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.