From 36129af4471e2aa1713693699762374d1b5a697b Mon Sep 17 00:00:00 2001 From: Jc2k Date: Thu, 1 Aug 2019 16:35:19 +0100 Subject: [PATCH] Fix polling HomeKit devices with multiple services per accessory (#25629) --- homeassistant/components/homekit_controller/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/homeassistant/components/homekit_controller/__init__.py b/homeassistant/components/homekit_controller/__init__.py index fd9c960980c..79636cea9f3 100644 --- a/homeassistant/components/homekit_controller/__init__.py +++ b/homeassistant/components/homekit_controller/__init__.py @@ -120,13 +120,21 @@ class HomeKitEntity(Entity): """Collect new data from bridge and update the entity state in hass.""" accessory_state = self._accessory.current_state.get(self._aid, {}) for iid, result in accessory_state.items(): + # No value so dont process this result if "value" not in result: continue + + # Unknown iid - this is probably for a sibling service that is part + # of the same physical accessory. Ignore it. + if iid not in self._char_names: + continue + # Callback to update the entity with this characteristic value char_name = escape_characteristic_name(self._char_names[iid]) update_fn = getattr(self, "_update_{}".format(char_name), None) if not update_fn: continue + # pylint: disable=not-callable update_fn(result["value"])