Skip to content

Fix polling HomeKit devices with multiple services per accessory#25629

Merged
Jc2k merged 2 commits into
home-assistant:devfrom
Jc2k:homekit_controller_polling_fix
Aug 1, 2019
Merged

Fix polling HomeKit devices with multiple services per accessory#25629
Jc2k merged 2 commits into
home-assistant:devfrom
Jc2k:homekit_controller_polling_fix

Conversation

@Jc2k
Copy link
Copy Markdown
Member

@Jc2k Jc2k commented Aug 1, 2019

Description:

While testing the new beta to see if #25249 helped with scaling and stability issues with many homekit entities @niemyjski reported seeing this traceback:

2019-08-01 07:54:51 ERROR (MainThread) [homeassistant.components.homekit_controller] Exception in async_state_changed when dispatching 'homekit_controller_43:0A:AB:59:F0:BC_state_updated': ()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/__init__.py", line 126, in async_state_changed
    char_name = escape_characteristic_name(self._char_names[iid])
KeyError: 66

HomeKit accessories are made up of Accessories, Services and Characteristics. Most of the devices i work with are either a single accessory with a single service or for a bridge like Hue, many accessories each with a single service. But there are also devices with many accessories and many services and also 1 accessory with many services. Sensors often have CO2, temperature and humidity as a single accessory with multiple services.

The code in #25249 didn't adequately consider these devices and failed when encountering a characteristic from another service on the same accessory. This PR handles that case.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]

@Jc2k
Copy link
Copy Markdown
Member Author

Jc2k commented Aug 1, 2019

Can this be go in 0.97.0 too as its a regression.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo.

Comment thread homeassistant/components/homekit_controller/__init__.py Outdated
@MartinHjelmare MartinHjelmare added this to the 0.97.0 milestone Aug 1, 2019
Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
@Jc2k Jc2k merged commit 36129af into home-assistant:dev Aug 1, 2019
@lock lock Bot locked and limited conversation to collaborators Aug 2, 2019
@Jc2k Jc2k deleted the homekit_controller_polling_fix branch December 7, 2019 09:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants