How to Set Up the HomeKit Bridge in Home Assistant (Bridge vs Accessory Mode, Filters, Pairing)
The HomeKit Bridge integration publishes Home Assistant entities to Apple Home and Siri, even when the device under them has never heard of HomeKit. On this site it is the last hop for every camera: the Ring guide and the Reolink guide both end with one. This page is the bridge on its own: what the modes mean, what to expose, and what to check when pairing will not finish.
Not to be confused with the HomeKit Device integration, which goes the other way and pulls HomeKit accessories into Home Assistant.
The page is dressed like a 1998 personal site. The options are from the current Home Assistant docs. Copy them from the Notepad boxes.
1 Add the HomeKit Bridge
Home Assistant often discovers it on its own. If not: Settings, Devices & services, Add Integration, HomeKit Bridge. Pick the domains you want in the Home app and finish the flow.
You can also define a bridge in configuration.yaml. Pick one way per bridge and stay with it. A bridge made in the UI is edited in the UI. A bridge made in YAML is edited in YAML. If you add YAML for a bridge that was made in the UI, you get a second bridge on another port instead.
homekit:
- name: HASS Bridge
filter:
include_domains:
- light
- switch
The name has to be unique on the network, 3 to 25 characters, letters, numbers, and spaces.
2 Bridge mode or accessory mode
- Bridge mode
- The default. One HomeKit entry carries many entities. Good for lights, switches, sensors, and climate.
- Accessory mode
- One HomeKit entry carries exactly one entity. Required for cameras, locks, TV and receiver media players, and remotes with activities.
To add a single camera in accessory mode from the UI: create a new HomeKit Bridge, open its options before you pair it, change the mode to accessory, pick the entity, and finish. Then pair that one entry.
There is a shortcut for a lot of them at once. Create a bridge with the camera, lock, media player, and remote domains selected. Home Assistant makes a separate accessory-mode entry for each entity that needs one. The original bridge can then be removed if nothing else is on it.
Each HomeKit entry listens on its own TCP port. The first is 21063. In YAML, give each extra entry a different port.
homekit:
- name: HASS Bridge
filter:
include_domains:
- light
- name: Front Door Cam
mode: accessory
port: 21064
filter:
include_entities:
- camera.front_door
3 Filter what Apple Home sees
Filters decide which entities a bridge publishes. You can include or exclude by domain, by entity id, or by glob. Keep it small. HomeKit allows at most 150 accessories per bridge, and a bridge that tries to carry more will hang during pairing. Split into more bridges if you need more.
homekit:
- name: HASS Bridge
filter:
include_domains:
- light
include_entity_globs:
- binary_sensor.*_occupancy
exclude_entities:
- light.garage_test_bulb
entity_config:
light.kitchen_table:
name: Kitchen Table Light
HomeKit keys each accessory to the entity id. If you rename an entity that has no unique id, the Home app forgets the room, name, and scenes you set for it.
4 Ports, Docker, and mDNS
The Home app finds the bridge with mDNS, then connects to it over TCP. If either one is blocked, the bridge never shows up.
- UDP 5353 for mDNS.
- TCP 21063, or whatever
porteach bridge uses. - With HomeKit Secure Video on a camera, a random TCP port per camera that changes on every start. Allow all TCP from the home hubs to Home Assistant.
In Docker, use host networking. That is how this server runs Home Assistant.
services:
homeassistant:
network_mode: host
If you have to keep Docker network isolation, set advertise_ip to the Docker host’s LAN address and run an mDNS reflector, such as avahi-daemon in reflector mode, on the host. A server with several addresses can also need ip_address, so the bridge binds to the right one.
homekit:
- name: HASS Bridge
advertise_ip: "192.168.1.50"
Hub and server on different VLANs? That is its own page: mDNS across VLANs.
5 Pair it in the Apple Home app
Home Assistant shows the pairing QR code and PIN in a notification, under the bell icon. In the Home app, add an accessory, scan the QR code, or choose More options and pick the bridge. Confirm the uncertified accessory with Add Anyway, enter the PIN if you did not scan, and finish.
Open the Apple Home app
Add Accessory
Scan the QR code, or More options > HASS Bridge
Add Anyway (uncertified accessory)
Enter the PIN from the notification if asked
Next, then Done
Moving Home Assistant to a new machine? Stop both instances, then copy the .storage/homekit.* files with the rest of the config, and the pairing comes along.
6 Troubleshooting
The bridge does not appear in the Home app
Usually the network. Check that the iPhone is on the same local network, try Wi-Fi and wired, try another port, and in Docker use network_mode: host.
Pairing hangs
Look in the log for Starting accessory Home Assistant Bridge on address and check it is the right interface. If not, set ip_address. Check you are under 150 accessories. If you see NonUniqueNameException, give the zeroconf integration default_interface: true and a unique name. To find a bad entity, pair with a minimal filter first, then add entities back.
Turn on debug logs while you chase it, and turn them back down when it pairs.
logger:
default: warning
logs:
homeassistant.components.homekit: debug
pyhap: debug
Accessories say No Response
Restart the home hub. Older hubs struggle with a lot of cameras and Bluetooth accessories. HomePods and newer Apple TVs on Ethernet hold up best.
You changed an option and the Home app did not notice
Changes to an existing accessory only show up after it is reset. Use the HomeKit reset accessory action on that entity. You will have to set the room and name again. If a device still shows the accessory as unavailable, the unpair action removes every pairing so you can pair it fresh.
Comments
Loading comments…