Homekit integration fails to setup or install correctly

I can’t get the Homekit component to setup/install correctly. It fails with an error. The only action i’ve taken is added the line for homekit: to my configuration.yaml per the instructions in the docs.

Running v0.109.6 in Docker

Can anyone decipher this error?

Here is the full error message:

Logger: homeassistant.setup
Source: components/homekit/accessories.py:329
First occurred: 7:27:40 PM (1 occurrences)
Last logged: 7:27:40 PM

Error during setup of component homekit
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/socketserver.py", line 452, in __init__
    self.server_bind()
  File "/usr/local/lib/python3.7/http/server.py", line 137, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/local/lib/python3.7/socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 171, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 170, in async_setup
    await hass.async_add_executor_job(homekit.setup)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 374, in setup
    interface_choice=self._interface_choice,
  File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 329, in __init__
    super().__init__(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/pyhap/accessory_driver.py", line 220, in __init__
    self.http_server = HAPServer(network_tuple, self)
  File "/usr/local/lib/python3.7/site-packages/pyhap/hap_server.py", line 840, in __init__
    super(HAPServer, self).__init__(addr_port, handler_type)
  File "/usr/local/lib/python3.7/socketserver.py", line 455, in __init__
    self.server_close()
  File "/usr/local/lib/python3.7/site-packages/pyhap/hap_server.py", line 911, in server_close
    for sock in list(self.connections.values()):
AttributeError: 'HAPServer' object has no attribute 'connections'

SOLVED

Found the solution in Hassbian 0.68 Error during setup of component homekit #14167.

Turns out my Homebridge container was using the same port as this Homekit integration (port 51827). No idea why my Homebridge app was using that port because the default is actually 51826… I guess I have my past self to thank for that.