jlusiardi / homekit_python

A python implementation to work as both HomeKit controller and accessory.
Apache License 2.0
221 stars 41 forks source link

KeyError during discovery #150

Closed Jc2k closed 5 years ago

Jc2k commented 5 years ago

A HA user has reported a KeyError whilst doing discovery. It looks like there might be a feature flag we don't recognise. Their report is here.

  File "/usr/local/lib/python3.7/site-packages/homekit/controller/controller.py", line 89, in discover
    return discover_homekit_devices(max_seconds)
  File "/usr/local/lib/python3.7/site-packages/homekit/zeroconf_impl/__init__.py", line 102, in discover_homekit_devices
    info.properties
  File "/usr/local/lib/python3.7/site-packages/homekit/zeroconf_impl/__init__.py", line 153, in parse_discovery_properties
    d['flags'] = FeatureFlags[flags]
  File "/usr/local/lib/python3.7/site-packages/homekit/model/feature_flags.py", line 33, in __getitem__
    raise KeyError('Item {item} not found'.format(item=item))
KeyError: 'Item 2 not found'

I have asked what device they are trying to pair.

jlusiardi commented 5 years ago

Hey @Jc2k,

looks like #143 (merged on the weekend) perhaps I should craft a new release.

Regards Joachim

Jc2k commented 5 years ago

Aha, indeed it does. A new release could be handy indeed.

Cheers John

jlusiardi commented 5 years ago

0.15.0 is out for you!

SimonThoustrup commented 5 years ago

Hi. Similar error on 0.96.5 when selecting HomeKit Accesory from the 'Add new Integration' menu. I never see the next input box, the system just reloads the 'Add new Integration' menu.

File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homekit/controller/controller.py", line 89, in discover return discover_homekit_devices(max_seconds) File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homekit/zeroconf_impl/init.py", line 102, in discover_homekit_devices info.properties File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homekit/zeroconf_impl/init.py", line 153, in parse_discovery_properties d['flags'] = FeatureFlags[flags] File "/usr/local/share/homeassistant/lib/python3.7/site-packages/homekit/model/feature_flags.py", line 33, in getitem raise KeyError('Item {item} not found'.format(item=item)) KeyError: 'Item 2 not found'

Jc2k commented 5 years ago

@SimonThoustrup thanks for the comment but that should really go on the HASS ticket I mentioned unless you can reproduce it outside of HASS with the latest homekit_python package.

The fix is in a homekit_python release but it’s not yet in a HASS release, so there’s nothing to do on the homekit_python side.

jlusiardi commented 5 years ago

@Jc2k can we close this?

Jc2k commented 5 years ago

I think so!