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
74.17k stars 31.14k forks source link

Unable to add devices to HomeKit Controller #17672

Closed sarabveer closed 5 years ago

sarabveer commented 6 years ago

Home Assistant release with the issue: 0.80.3

Last working Home Assistant release (if known): 0.78.0

Operating environment (Hass.io/Docker/Windows/etc.): Docker

Component/platform: HomeKit controller support (https://www.home-assistant.io/components/homekit_controller/)

Description of problem:

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

discovery:
  enable:
    - dlna_dmr
    - homekit

Traceback (if applicable):

Sun Oct 21 2018 11:13:33 GMT-0400 (Eastern Daylight Time)

Error executing service <ServiceCall configurator.configure (c:a393f71515ba4a8b90ffc5708161426c): configure_id=139979180631208-3, fields=code=XXX-XX-XXX>
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/core.py", line 1177, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/src/app/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/src/app/homeassistant/components/homekit_controller/__init__.py", line 195, in device_config_callback
    pairing_id)
  File "/config/deps/lib/python3.6/site-packages/homekit/protocol.py", line 94, in perform_pair_setup
    resp = connection.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

Additional information:

TXC commented 6 years ago

What kind of devices would you like to add?

sarabveer commented 6 years ago

What kind of devices would you like to add?

Attempting to add the iHome iSP5 and iSP8

sarabveer commented 6 years ago

Just downgraded HA to v0.78.0, I am able to add and control them successfully.

Re-updating again to v0.80.3, I am still able to control them successfully.

drndos commented 6 years ago

Try increasing timeout from 5 seconds to 30 seconds that is configurable in homekit_controller/_init_.py file REQUEST_TIMEOUT = 5 # seconds

jonsteinmetz commented 6 years ago

I would like to experiment with changing the timeout value as I am having trouble adding a MyQ 819LMB to Home Assistant. I am afraid I am having trouble locating the homekit_controller/__init__.py file in my installation on a raspberry pi with a standard hassio installation. Can anyone give me a hint as to where these files are stored? I realize this is a stupid question but so far I have not been able to find them.

drndos commented 6 years ago

Hello try, /srv/homeassistant/libs/python3.5/site-packages/homeassistant/components/homekit_controller/ Or find -name "*monkey_patch.py*" and go from that directory.

jonsteinmetz commented 6 years ago

Thanks. That directory is empty on my raspberry pi and searching for "monkey_patch.py" found nothing. Based on what I have been reading the configuration directory is in a docker container running on the pi. So it appears that one has to do the work to be able to log in to the docker container.

I was able to copy homekit_controller/__init__.py from GitHub and put the file in the custom_containers directory on the pi, edit a constant in the file, and see it take after I rebooted hassio.

b1gbake commented 6 years ago

I'm having the same issue as OP

Phortieteaux commented 5 years ago

Reporting the same issue in both 0.83.x and 0.84.x. I was also able to revert to an older snapshot (version 0.79.3) and install the ispx6 (iHome). Upgrading back to 0.84.1, I am able to control the ispx6es.

Haven't had a chance to play with REQUEST_TIMEOUT yet, but I do have another ispx6 lying around here somewhere that I haven't configured yet - will test if I can find it :)

Phortieteaux commented 5 years ago

Took a little while to test since I was busy migrating HA off of a Pi onto a QNAP 451+ (where I saw the same issue). Changing REQUEST_TIMEOUT = 30 in homekit_controller/__init__.py did resolve the issue for me, and I was able to add all 3 of my ispx6 switches. Thanks!!

ryancpratt commented 5 years ago

I’m having an additional problem related to this. I have my isp5 added successfully to HA and can control it with HA. The device doesn’t feed back into the iOS home app for control with SIRI however. Am I misunderstanding how this integration works or how can I fix this?

niemyjski commented 5 years ago

I'm also seeing some issues with 0.78. I was able to configure my Ecobee switch+ but nothing ever shows up and the configurator is gone..

2019-02-07 18:10:56 INFO (MainThread) [homeassistant.components.discovery] Found new service: homekit {'host': '10.0.1.233', 'port': 1200, 'hostname': 'Office-2.local.', 'properties': {'c#': '4', 'ff': '1', 'id': 'AA:86:E3:dd:yy:zz', 'md': 'ecobee Switch+', 'pv': '1.1', 's#': '1', 'sf': '0', 'ci': '8', 'sh': 'oVSiCQ==', 'serial_number': 'xxx78357xxxx', 'MFG': 'ecobee Inc.'}, 'name': 'Office (2)'}

2019-02-07 18:11:38 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/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 362, in discovery_dispatch
    device = HKDevice(hass, host, port, model, hkid, config_num, config)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 98, in __init__
    self.accessory_setup()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 112, in accessory_setup
    data = self.pairing.list_accessories_and_characteristics()
  File "/usr/local/lib/python3.6/site-packages/homekit/controller.py", line 272, in list_accessories_and_characteristics
    self.session = Session(self.pairing_data)
  File "/usr/local/lib/python3.6/site-packages/homekit/controller.py", line 604, in __init__
    c2a_key, a2c_key = get_session_keys(conn, pairing_data)
  File "/usr/local/lib/python3.6/site-packages/homekit/protocol/__init__.py", line 247, in get_session_keys
    ios_key = x25519.X25519PrivateKey.generate()
  File "/usr/local/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py", line 39, in generate
    _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM
cryptography.exceptions.UnsupportedAlgorithm: X25519 is not supported by this version of OpenSSL.
drndos commented 5 years ago

I’m having an additional problem related to this. I have my isp5 added successfully to HA and can control it with HA. The device doesn’t feed back into the iOS home app for control with SIRI however. Am I misunderstanding how this integration works or how can I fix this?

You need to expose it via HomeKit component https://www.home-assistant.io/components/homekit/

sarabveer commented 5 years ago

Changing REQUEST_TIMEOUT to 30 fixed the issue as well for me. I will open a PR for this.

Hucksleyy91 commented 5 years ago

I’m on 0.89.2 It has accepted my pin code but nothing is showing up, I’ve tried to find the init.py but the folder homekit_controller does not exist to make the changes to REQUEST_TIMEOUT 30

Also not sure how to find custom_containers Or edit constant in file

This is running on a rpi3 with standard installation from there website

Jc2k commented 5 years ago

Please note that REQUEST_TIMEOUT doesn't work any more - there is literally no code in homekit_controller that looks at it. The particular error that it fixed should be resolved, though. If you are still having issues you should raise a new ticket.

MartinHjelmare commented 5 years ago

Should we close this issue?

Jc2k commented 5 years ago

Yes I think so - the advice is just out of date and potentially misleading now, and all the reported tracebacks have known fixes. If there are any other remaining issues we need to start from scratch.