Looking for help: HomeKit YAML configuration not working, throwing "task exception" error on start

Hi, I’m having some issues when trying to set up HomeKit within my configuration.yaml and even in the most basic of configurations it’s not working. I’m stumped here as I’m able to successfully set up via the UI (but don’t want to go down that path because I want to exclude certain globs).

I’m running HA on a Raspberry Pi 4 for background.

Here's my configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

homeassistant:
  name: "Home"
  customize: !include customize.yaml

logger:
  default: warning
  logs:
    homeassistant.components.homekit: debug
    pyhap: debug

# Text to speech
tts:
  - platform: google_translate

# HomeKit
homekit:
  auto_start: false

# Includes
group: !include groups.yaml
automation: !include automations.yaml
light: !include light-groups.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
adaptive_lighting: !include adaptive-lighting.yaml

Note: ideally I would like to do an include for HomeKit and put it in its own file, but in the interest of starting out basic this is where I am.

Logger: homeassistant
Source: components/homekit/config_flow.py:190 
First occurred: 9:32:45 AM (1 occurrences) 
Last logged: 9:32:45 AM

Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 130, in async_init
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/homekit/config_flow.py", line 144, in async_step_import
    if not self._async_is_unique_name_port(user_input):
  File "/usr/src/homeassistant/homeassistant/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'

Would love any help anyone might be able to offer on this as I’m currently blocked from getting HomeKit going as a result!

1 Like

Try giving your HomeKit the name: option.

homekit:
  auto_start: false
  name: Whatever

If that fixes it, it looks like someone left out the default name for when none was provided.

Thanks! Forgot to mention that I’d tried that one before—same result unfortunately.

Ok, I’m out of ideas then. Hopefully someone else can help.

1 Like

Did you figure this out @galligan? Having the same issue.

Unfortunately, I didn’t get any further. I just threw my hands up and went the UI route—bummed that I can’t exclude globs that way and just resorted to excluding individual entities.

Can confirm I had the same experience. I am also throwing my hands up but doing a re-image to try again. I saw a lot referencing deleting the existing HomeKit state and restarting, but I could not find the HomeKit state file.

I was having this same issue until I came across this thread on github. It worked to fix this issue for me so I wanted to share.

1 Like