Controlling My R1T With Docker Home Assistant and Homekit

3 minute read

Recently, the Rivian Home Assistant (HASS) added support for controlling the vehicle. Alongside the HomeKit integration this meant my truck was now available via iOS17 HomeKit widgets. Unfortuantely (but also fortunately) it seems the method by which the Rivian integration worked was patched which meant the integration needed to be updated for the commands to send to the truck. The folks were quick and began iterating as beta users were reporting their experiences with the pairing process.

For me, this meant figuring out how to make the BT pairing work through docker with my truck 20ft away.

Home Assistant

home-assistant:
    container_name: home-assistant
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    depends_on:
      - HDDTemp
    environment:
      - TZ=America/New_York
      - HOST_OS=Unraid
    image: homeassistant/home-assistant
    network_mode: "host"
    volumes:
      - /mnt/user/configs/home-assistant:/config:rw
      - /run/dbus:/run/dbus:ro
      - /dev/bus/usb/001/009:/dev/bus/usb/001/009
    working_dir: /config
    devices:
      - /dev/bus/usb/001/009:/dev/bus/usb/001/009

The key information here is the volume bind for /run/dbus which allows the container to submit dbus messages for BT pairing (mentioned here).

Additionally, I needed to map the USB device corresponding to my motherboard’s BT radio. This can be found by running lsusb, which for me returned this obscure entry: Bus 001 Device 009: ID 8087:0033 Intel Corp.

HomeKit

homekit:
  - filter:
      include_domains:
        - alarm_control_panel
        - camera
        - climate
        - cover
        - lock
        - light
        - media_player
        - scene
        - fan
        - script
        - switch
        - input_boolean
      exclude_entities:
        - cover.cheddar_front_trunk
        - cover.cheddar_windows

This is the main part of my homekit config. I believe newer HASS instances can do homekit configuration via web, so take this as reference and not as a guide. This will create a HomeKit bridge entity that you pair with your Home app. Any entities in HASS that fit the domains will be proxied over.

Troubleshooting

This process wasn’t as smooth as I’d hoped. My host machine is running Unraid, which doesn’t ship with bluez, this meant I needed to get bluez installed from slackware. From there, it seems my BT stack was either getting overwhelmed or running out of pairing slots for fun. I realized that toggling the power to the radio with hciconfig seemed to give me enough time to control other BT accessories with HASS before things started timing out. While sitting in the truck, I toggled BT power, then initiated the key pairing sequence. Eventually it worked

Updated: