Core: HomeKit Controller – Koogeek Light Strip - no entities added even if accessory was found

Created on 5 Nov 2018  Â·  14Comments  Â·  Source: home-assistant/core

Trying to add Koogeek Light Strip to HA. Paired with Koogeek app without errors but, when I try to configure:

discovery:
  enable:
    - homekit

My LightStrip is discovered fine, but when I click on "Configure" in UI, enter the PIN code (correct one) – it closes popup and gives no further info, including no accessories added.

Log says:

Log Details (ERROR)
Error executing service <ServiceCall configurator.configure (c:f0341c70f4634caf9e007bce8a56b2b0): configure_id=547938337344-1, fields=code=614-35-987>
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 191, in device_config_callback
    pairing_id)
  File "/usr/local/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
homekit_controller

Most helpful comment

For users watching this thread about Hass.io specific SSL Algorithm errors - they should be gone as of 0.88.

AFAIK, all Koogeek LS1 issues in this issue are now solved.

All 14 comments

I have installed hassio from the beggining, tryng to do some troubleshooting:

1.- Versión 0.81.6 -> same error, timed out.

2.- Downgraded to 0.74.0 -> accesories can be paired correctly, without errors.

So it seems that something is not working since last version.

Copied .homekit files directly from 0.74.0 sd card to 0.82.0 sd card. I can see my devices now and they are working fine.

Same here in 0.82.1 at the moment of writing this.

Koogeek devices (homekit versions) can't be paired either.

socket.timeout: time out every time i've tried. Same log output than @cwendigo

Downgrading directly from 0.82.1 to 0.74, 0.79 or 0.78 didn't work, and HA rollback itself to latest. Doing it from 0.82.1 to 0.80.0 and from there to 0.79.0 works for me.

With 0.79.0 installed the devices paired.

Pairing Homekit devices tested on:

  • 0.82.1 - Not working socket.timeout: time out
  • 0.82.0 - Not working socket.timeout: time out
  • 0.81.2 - Not working socket.timeout: time out
  • 0.80.0 - Not working socket.timeout: time out
  • 0.79.0 - Homekit devices pair again!

More about Homekit Koogeek devices. Trying to add KH02CN Smart Switch.

Pairing:
0.82.1 - time out
0.74 - paired without errors but…

No new entities shown. I can see at registry:"
"kh02cn changed to configured "
but, in log:

"
2018-11-19 20:10:26 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 258, 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 106, in __init__
    self.accessory_setup()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 120, in accessory_setup
    data = json.loads(response.read().decode())
  File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
"

Thank you in advance.

Same here, well... kind of.

Back in 0.82.1 (with devices paired on 0.79) multiple warning outputs in the log.

Devices work right after restart (HA) for a period of time but always end unresponsive after a while.

Koogeek Smart Power Strip O1EU (3 outlets). Failing 3 of them.

Log output sample:

Update of switch.o1eu_3 is taking over 10 seconds
Update for switch.o1eu_3 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  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 250, in update
    data = self._accessory.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)
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/secure_http.py", line 66, in get
    return self._handle_request(data)
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/secure_http.py", line 92, in _handle_request
    return self._read_response()
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/secure_http.py", line 158, in _read_response
    response.parse(self.decrypt_block(length, block, tag))
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/response.py", line 38, in parse
    self._raw_response += part
TypeError: can't concat bool to bytearray
Failed to connect to homekit device
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit_controller/__init__.py", line 164, in get_json
    data = json.loads(response.read().decode())
  File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Having the same issue here, always getting the error
Incorrect HomeKit code for LS1. Please check it and try again. when pairing it (the code is correct)

So I made it work. I basically removed the .storage folder, downgrade to 0.74.0, paired all my homekit components and back to 0.82.0

same issue with Hassio 83.1

Error executing service <ServiceCall configurator.configure (c:ae44e14a60e943b5b732434edc0650c5): configure_id=1930207920-1, fields=code=XXX-XX-XXX>
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 192, in device_config_callback
    pairing_id)
  File "/usr/local/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

How can I fix it?

me too :(
ha 0.85.0

2019-01-15 15:52:55 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.ls1 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  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 197, in update
    data = pairing.list_accessories_and_characteristics()
  File "/usr/local/lib/python3.6/site-packages/homekit/controller.py", line 273, in list_accessories_and_characteristics
    response = self.session.get('/accessories')
  File "/usr/local/lib/python3.6/site-packages/homekit/controller.py", line 573, in get
    return self.sec_http.get(url)
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/secure_http.py", line 65, in get
    return self._handle_request(data)
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/secure_http.py", line 89, in _handle_request
    return self._read_response()
  File "/usr/local/lib/python3.6/site-packages/homekit/http_impl/secure_http.py", line 131, in _read_response
    data = self.sock.recv(exp_len)
socket.timeout: timed out

I believe this could be the underlying issue:
[https://github.com/home-assistant/home-assistant/issues/18949]

Looks like an issue with underlying docker image being used (alpine) and openssl version

An updated version of alpine was released today so hopefully the Hassio peeps are rushing to update to using alpine 3.9.

The above issue also references
https://github.com/home-assistant/hassio/issues/903

Hi guys - i contributed the fix for #18949. It should be in the next release of HA and work for anyone using the Docker or virtualenv install methods (I have tested on Ubuntu, Debian, Raspbian and even a Mac).

Unfortunately, as @lamboid says, there is still an issue with the version of OpenSSL used by the hass.io teams Docker images. I have asked about this and they are working on Alpine 3.9 but its a fairly large change from Alpine 3.8 for them but it will come eventually.

@Jc2k there is an open issue about upgrading Hass.io to Alpine 3.9 so I can subscribe to be notified when is released? Thank you.

@rdelcampog i saw a PR land to enable Alpine 3.9 in the past couple of days - https://github.com/home-assistant/hassio-base/pull/7. It's already merged so hopefully its not long, but i've not seen any more hints than this.

There is this ticket here that i've been prodding - https://github.com/home-assistant/hassio/issues/903, but no indication its been updated by anyone who is working on the 3.9 update.

For users watching this thread about Hass.io specific SSL Algorithm errors - they should be gone as of 0.88.

AFAIK, all Koogeek LS1 issues in this issue are now solved.

Was this page helpful?
0 / 5 - 0 ratings