Support for direct control of HomeKit devices just got merged, and ought to be in 0.68. It’s not enabled by default and could do with broader testing (it works fine for me, but the amount of hardware I have is limited). To enable it, make sure configuration.yaml has the following:
discovery:
enable:
- homekit
and any IP-based HomeKit devices on your network should appear. You’ll need to enter the homekit code from the web UI, but this pairing information will be saved. Once paired, if a device provides any lights or switches these should automatically be added to the UI. Things I’m interested in:
Bulbs and switches that don’t work
Devices that appear under HomeKit but which are already supported by HASS
(1) is stuff that I’ll want to fix up as quickly as possible. (2) is stuff that we’ll want to blacklist from the HomeKit code in order to leave it up to the native code (for instance, Tradfri has HomeKit support, but only for Ikea bulbs - if you use any Hue bulbs, they won’t appear, so we want to continue using the Tradfri component and block the HomeKit component from finding it)
Trying to test on a fresh install of Debian 9.4 but setting up homekit-controller failed due to missing dependencies - have you added a section to the docs somewhere that notes the required system libs to install gmpy2 (a dep of homekit)? Looks like gmp, mpfr, and mpc.
Edit - to my base Debian install, I needed to do:
apt install libgmp-dev libmpfr-dev libmpc-dev
Before pip install gmpy2 would work inside my HA venv.
Trying to connect to a Hue Bridge as a first test, but hitting configure in the frontend and entering the code from the bottom of the bridge (both with dashes and without) results in:
Error executing service <ServiceCall configurator.configure: configure_id=140564616230840-3, fields=code=72785369>
Traceback (most recent call last):
File "/root/home-assistant/homeassistant/core.py", line 1002, in _event_to_service_call
await service_handler.func(service_call)
File "/root/home-assistant/homeassistant/components/configurator.py", line 224, 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 "/root/home-assistant/homeassistant/components/homekit_controller/__init__.py", line 137, in device_config_callback
self.conn, code, pairing_id)
File "/root/home-assistant/lib/python3.5/site-packages/homekit/protocol.py", line 89, in perform_pair_setup
assert response_tlv[TLV.kTLVType_State] == TLV.M4
AssertionError
I’ve also just tried to pair with a Lutron Smart Bridge Pro 2 and have no success; the SUBMIT button on the frontend greys out and the circle spins endlessly, and HA appears to hang.
In the terminal (scrolling the HA log), the following is discovered:
2018-04-13 14:56:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=configurator.smart_bridge_pro_2, old_state=None, new_state=<state configurator.smart_bridge_pro_2=configure; description=Please enter the HomeKit code for your Smart Bridge Pro 2, entity_picture=None, fields=[{'type': 'string', 'name': 'HomeKit code', 'id': 'code'}], submit_caption=submit, configure_id=139655092167064-1, friendly_name=Smart Bridge Pro 2 @ 2018-04-13T14:56:25.057776-04:00>>
After I click submit, the terminal immediately displays the following and HA hangs:
I’ve added support for providing more useful feedback when pairing fails, but it needs an updated version of the homekit package first. I’ll update once that’s merged.
Error executing service <ServiceCall configurator.configure: configure_id=140274439927624-2, fields=code=836-36-833>
Traceback (most recent call last):
File “/usr/src/app/homeassistant/core.py”, line 1002, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/src/app/homeassistant/components/configurator.py”, line 224, 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/src/app/homeassistant/components/homekit_controller/init.py”, line 138, in device_config_callback
pairing_id)
File “/config/deps/lib/python3.6/site-packages/homekit/protocol.py”, line 67, in perform_pair_setup
connection.request(‘POST’, ‘/pair-setup’, request_tlv, headers)
File “/usr/local/lib/python3.6/http/client.py”, line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/usr/local/lib/python3.6/http/client.py”, line 1250, in _send_request
self.putrequest(method, url, **skips)
File “/usr/local/lib/python3.6/http/client.py”, line 1108, in putrequest
raise CannotSendRequest(self.__state)
http.client.CannotSendRequest: Request-sent
Hello, I’ve been considering switching over from zwave to homekit for my lighting devices to have more reliable control so went out and purchased a few Leviton dimmers and switches for testing knowing this component ensures we aren’t completely trapped into Apple’s ecosystem.
I have the controller working after updating the dependencies as @marthocoo has pointed out to make gmpy2 happy but it says the device has already been paired when I try to pair it. I did first pair with Home app on my phone (which has an ATV associated).
Do I have to associate all of my devices with HA and then expose them via the HomeKit component and only one device can pair or is something else wonky (it’s possible I used the wrong code, it’s late and I’m also trying to figure out what 4 different light switches codes are blindly).
Yes, you can only pair one device at once - if you reset the devices and then pair them with Home Assistant, you can export them back with the HomeKit component in order to pair them with Home.
I’m using hassio and the ssh addon wont allow me to run those commands.
It may be a silly question, but is there anyway i can install the depencencies?
No there isn’t. You’ll have to wait until the underlying Docker image is fixed. I’ve opened a PR to add the dependencies to the main docker image, and I’m sure it will make its way to the RaspBerry Pi images after that.
So my guess is these devices (Leviton Dimmer) use bluetooth initially to get the WiFi password so how is this supposed to work without Bluetooth available, does this controller component support bluetooth (I have it disabled on my PI as it’s suggested to for whatever reason when using a GPIO z-wave shield). Halp!