Hello,
i´m pretty new to HASS and i´m stugeling with the Homekit integration. So i have some enteties that i want to add in Homkit witht the following config:
2020-11-18 11:48:55 ERROR (MainThread) [homeassistant.setup] Error during setup of component homekit
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
result = await task
File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 160, in async_setup
entries_by_name = {entry.data[CONF_NAME]: entry for entry in current_entries}
File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 160, in <dictcomp>
entries_by_name = {entry.data[CONF_NAME]: entry for entry in current_entries}
KeyError: 'name'
try removing the leading - in front of name: and indent it 2 spaces from the homekit: header. I know the docs show it in the example, but my config does not have any hyphens and it works.
EDIT: I only have 1 homekit bridge, so that’s probably why I don’t have the leading hyphens and it works. If I were to add multiple bridges to my YAML config, then I’d probably need the hyphens.
2020-11-19 21:17:35 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 128, in async_init
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/config/custom_components/homekit/config_flow.py", line 144, in async_step_import
if not self._async_is_unique_name_port(user_input):
File "/config/custom_components/homekit/config_flow.py", line 190, in _async_is_unique_name_port
if entry.data[CONF_NAME] == name or entry.data[CONF_PORT] == port:
KeyError: 'name'
Needed to patch also config_flow.py like this to get a working config:
from .const import (
BRIDGE_NAME,
...
@callback
def _async_is_unique_name_port(self, user_input):
"""Determine is a name or port is already used."""
name = user_input[CONF_NAME]
port = user_input[CONF_PORT]
for entry in self._async_current_entries():
if entry.data.get(CONF_NAME, BRIDGE_NAME) == name or entry.data[CONF_PORT] == port:
return False
return True
After that, impossible to get the Pairing Notification and nothing in the log
Still same issue.
I found a way to recover:
Remove HomeKit from configurations.yaml and from Integrations UI.
In the config folder, edit the .storage/core.config_entries, remove the entry_id related to HomeKit like this one (not the one of Hue):
Followed Manu3b’s advice and deleted the entry from .storage/.core.config_entries then rebooted. Fixed the issue, however its worth mentioning that when I used a list to define the entry (ie where you have more than one HomeKit bridge) it didn’t work.
ie:
homekit:
- name: testha
filter:
didn’t work - but this did:
homekit:
name: testha
filter:
looks like rebooting and clearing out the old config is essential.