HomeKit Integration can't start because a JSON value somewhere is invalid

Hello, somewhere in my Home Assistant configuration there’s some invalid JSON value that causes the HomeKit integration to always fail to start. Before I go learn how to hook up the debugger and get all that jazz working, does someone know where this JSON value is coming from so I can go fix it?

I’m running Home Assistant 2022.8.7 running on docker/hass.io.

Thank you so much!

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 729, in async_start
    await self.hass.async_add_executor_job(self.setup, async_zc_instance, uuid)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 534, in setup
  File "/usr/local/lib/python3.10/site-packages/pyhap/accessory_driver.py", line 655, in load
    self.encoder.load_into(file_handle, self.state)
  File "/usr/local/lib/python3.10/site-packages/pyhap/encoder.py", line 92, in load_into
    loaded = json.load(fp)
  File "/usr/local/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Post your YAML configuration, specifically for the HomeKit integration.

I’ve reduced the Homekit configuration down to just homekit: at this point to see if it would fix it and got no joy.
Here’s the full (lightly redacted) config file:

Config File
  # Name of the location where Home Assistant is running
  name: REDACTED
  latitude: REDACTED
  longitude: REDACTED
  elevation: REDACTED
  unit_system: imperial
  time_zone: America/New_York

# Configure a default setup of Home Assistant (frontend, api, etc)

# Discover some devices automatically
    - apple_tv

# Sensors
   # Weather prediction
  - platform: openweathermap
    api_key: REDACTED
      - weather
      - temperature
      - humidity
# Text to speech
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

  discovery: true
    - REDACTED 3 IPs
  - platform: harmony
    name: Kitchen Cable
    host: REDACTED
    activity: Watch TV

#  filter:
#    include_domains:
#      - sensor
#    #   - light
#    exclude_domains: 
#      - light
#    include_entities: 
#      - binary_sensor.attic_multi_door
#    exclude_entity_globs: 
#      - sensor.openweathermap*
#    exclude_entities: 
#      - switch.outdoor_light_over_garage
#      - light.front_walk
#      - switch.attic_fan

  usb_path: /dev/ttyUSB1
  database_path: /config/zigbee.db

And you reloaded the config file or rebooted HA after commenting out the HomeKit stuff? I use HomeKit extensively and very similar to your config with all the additional filter options and then some and have not run into an issue. You say you’re using docker but mention the old deprecated name for the supervisor type installation. Are you running HA supervised or HA container?

I’m using HA Supervised that I just set up this summer on top of Raspbian Bullseye using approximately these instructions.

It reports as Healthy and Supported right now.

And to answer the other question which I totally missed, I’ve done everything from rebooting HA core to rebooting the whole box.

You have a corrupt json file in .storage that starts with homekit

Months later but that was indeed it. Had to set the Homekit stuff up from scratch but at least it all works again.
The .storage file was just 0 bytes long, something must have truncated it somehow.

1 Like