Welcome to HomeKitLab · a home lab that leans toward Apple Home · everyone is welcome, whatever you run at home · Ring cameras, go2rtc, and Home Assistant · best viewed in Netscape Navigator 4.0 at 800×600 ·

How to Connect a Ring Doorbell to Apple HomeKit (Step-by-Step with go2rtc + Home Assistant)

NEW!

Ring cameras do not speak HomeKit. The doorbell in this setup sends H.265 video and Opus audio. Apple Home, and the Home Assistant camera path in front of it, want H.264 and AAC. This how-to is the route that works on a Linux home server: go2rtc transcodes the stream, the Ring integration in Home Assistant handles the ding and the motion events, and a HomeKit Bridge in accessory mode exposes that one camera to the Home app. When it is paired, see how to show Ring and Reolink cameras together in Apple Home.

The server this was worked out on runs Home Assistant in Docker with host networking. That matters later, because the camera URLs use 127.0.0.1 and mean the host, not a container. Anywhere a real id, token, or address would have been, there is a placeholder instead.

The page is dressed like a 1998 personal site. The commands are current. Copy them from the terminal boxes.

What you need
  • A Linux server, and a normal account to run go2rtc. The examples call that account user.
  • Home Assistant in Docker, using host networking.
  • A Ring camera on a Ring account you can sign in to.
  • An Apple home hub, a HomePod or an Apple TV, on a network that can reach the server. If a VLAN sits in between, mDNS has to be allowed across it.
  • The go2rtc binary for your architecture, from the project’s releases page.

Where each piece sits

go2rtc
Pulls the Ring stream, transcodes it, re-shares it over local RTSP, and serves the snapshot.
Ring integration
Doorbell and motion events only. It does not provide the camera video.
Generic Camera
Binds the go2rtc URLs to one Home Assistant camera entity.
HomeKit Bridge
Publishes that camera, in accessory mode, to the Apple Home app.

1 Install go2rtc and run it as a service

go2rtc is a single native binary. On this server it lives in ~/go2rtc/ next to its config, ~/go2rtc/go2rtc.yaml, and systemd keeps it running after a reboot.

The web UI and API listen on port 1984. RTSP listens on port 8554. Those are the defaults, so the config file does not have to set them.

A folder window titled ~/go2rtc showing the go2rtc binary and go2rtc.yaml, beside a service window for go2rtc.service. The description reads go2rtc camera streamer, the status is running, and the ports are 1984 and 8554.
The binary and the config live in ~/go2rtc. systemd runs go2rtc.service.

Download the binary for your machine, put it in the folder, and mark it executable.

terminal
mkdir -p ~/go2rtc
cd ~/go2rtc
chmod +x go2rtc
./go2rtc --version

Then add a system unit named go2rtc.service. The description string is go2rtc camera streamer. systemd does not expand ~, so the unit spells the folder out as /home/user/go2rtc. Replace user with the account that owns the folder before you enable the service.

go2rtc.service
[Unit]
Description=go2rtc camera streamer
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=user
WorkingDirectory=/home/user/go2rtc
ExecStart=/home/user/go2rtc/go2rtc -config /home/user/go2rtc/go2rtc.yaml
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target

Save that file as /etc/systemd/system/go2rtc.service, then load it and start it.

terminal
sudo systemctl daemon-reload
sudo systemctl enable --now go2rtc
systemctl status go2rtc

2 Sign in to Ring and keep the token private

go2rtc’s built-in Ring source authenticates with a Ring refresh token. Get that token from go2rtc’s own web UI, the Ring add flow at http://SERVER_IP:1984, or from a refresh-token tool you already trust. go2rtc stores it in ~/go2rtc/go2rtc.yaml.

Treat the token like a password.

  • Keep it out of screenshots, chat, and git. If the config is in a repo, the committed copy should still say YOUR_REFRESH_TOKEN.
  • Back up the config before you change it.
A go2rtc Ring window with the refresh token shown as asterisks, a warning that says keep it out of screenshots and git, and a backup file named go2rtc.yaml.bak.
The token stays masked. The backup file is go2rtc.yaml.bak.
terminal
cp ~/go2rtc/go2rtc.yaml ~/go2rtc/go2rtc.yaml.bak

3 Write the streams

Ring publishes H.265 video with Opus audio. Apple Home and Home Assistant need H.264 and AAC, so ffmpeg transcodes the source. A second stream re-shares that transcoded output over local RTSP, and a snapshot stream feeds the HomeKit preview tile.

The # marks on the ffmpeg line are go2rtc’s output options: video codec, size, and audio codec. The ? query on the source asks for the codecs Ring is already sending. 1280 by 1280 is the frame size used for this doorbell. Change those two numbers if you want a different size.

A flow from the Ring camera, H.265 and Opus, through ring_source and ffmpeg into ring_front_door as H.264 and AAC at 1280 by 1280, then split into ring_h264 over local RTSP and a JPEG snapshot.
One Ring source becomes an H.264 stream, a local RTSP re-share, and a still image.
go2rtc.yaml
streams:
  ring_source: "ring:?camera_id=YOUR_CAMERA_ID&device_id=YOUR_DEVICE_ID&refresh_token=YOUR_REFRESH_TOKEN"
  ring_front_door: "ffmpeg:rtsp://127.0.0.1:8554/ring_source?video=h265&audio=opus#video=h264#width=1280#height=1280#audio=aac"
  ring_h264: "rtsp://127.0.0.1:8554/ring_front_door?video=h264&audio=aac"
  ring_front_door_snapshot:
    - ring:?camera_id=YOUR_CAMERA_ID&device_id=YOUR_DEVICE_ID&refresh_token=YOUR_REFRESH_TOKEN&snapshot
log:
  level: info   # bump to debug / ring: trace when troubleshooting
ring_source
Pulls the camera straight from Ring and leaves the codec as the camera sends it, H.265 and Opus. Fill in the camera id, the device id, and the refresh token. Do not commit the filled-in file.
ring_front_door
Reads that RTSP stream on localhost port 8554 and transcodes it to H.264, 1280 by 1280, with AAC audio. This is the stream Home Assistant will open.
ring_h264
Re-shares the transcoded stream over local RTSP, so another client can take H.264 and AAC without starting ffmpeg again.
ring_front_door_snapshot
A still from the same camera. The list item with &snapshot is what HomeKit uses for the preview tile. The log line stays at info until something breaks. Step 9 shows the debug form.

4 Restart and verify

Restart the service, confirm it is running, and follow the log. journalctl -f keeps printing until you stop it with Ctrl+C.

A terminal showing go2rtc active and running, and a panel at port 1984 listing ring_source, ring_front_door, ring_h264, and ring_front_door_snapshot with green marks.
The service should be active, and all four streams should be listed in the web UI.
terminal
sudo systemctl restart go2rtc
systemctl status go2rtc
journalctl -u go2rtc -f

Open http://SERVER_IP:1984 and confirm the streams are listed and actually produce a picture. Then test the snapshot on the server itself.

terminal
curl -o /tmp/ring-snapshot.jpg "http://127.0.0.1:1984/api/frame.jpeg?src=ring_front_door_snapshot"

The same still is at http://127.0.0.1:1984/api/frame.jpeg?src=ring_front_door_snapshot in a browser on the server. You want a real frame of the camera, not an empty response.

5 Ring events in Home Assistant

In Home Assistant, open Settings, then Devices & services, then add the Ring integration. This integration is here for the doorbell ding and the motion events. On this server those entities are event.front_door_ding and event.front_door_motion. Yours will follow the device name Home Assistant assigns.

Camera video does not come from this integration. Video stays on go2rtc.

A Home Assistant window for the Ring integration listing event.front_door_ding and event.front_door_motion, with a note that video stays on go2rtc.
Ring in Home Assistant is the ding and the motion event. Nothing else.

This block is a note of the entity ids, so you can copy them into the HomeKit options in step 7. It is not a config file, and it does not add the Ring integration. You add Ring from the UI.

ring-events.yaml
ding: event.front_door_ding
motion: event.front_door_motion

6 Generic Camera

Still in Settings, Devices & services, add the Generic Camera integration. Because Home Assistant uses host networking, 127.0.0.1 is the server, which is where go2rtc is listening. On a bridge network that address would be the container, and these URLs would miss go2rtc. This note does not cover that layout.

A Generic Camera dialog. The still image points at the snapshot frame, the stream source is the local RTSP path, RTSP transport is TCP, and the frame rate is 2.
Four fields. The still image is the snapshot. The stream is RTSP, over TCP, at 2 frames per second.

Enter these in the dialog. The names are the ones from this setup. Yours can differ, as long as the URLs match the go2rtc streams.

generic-camera.yaml
name: Front Door
still_image_url: "http://127.0.0.1:1984/api/frame.jpeg?src=ring_front_door_snapshot&cache=10s"
stream_source: "rtsp://127.0.0.1:8554/ring_front_door"
rtsp_transport: tcp
framerate: 2
  • Still image URL: http://127.0.0.1:1984/api/frame.jpeg?src=ring_front_door_snapshot&cache=10s
  • Stream source: rtsp://127.0.0.1:8554/ring_front_door
  • RTSP transport: TCP
  • Frame rate: 2

The stream source is ring_front_door, the ffmpeg transcode, not ring_h264. The cache=10s parameter is part of the still URL that kept the preview updating in this setup.

7 HomeKit Bridge in accessory mode

Add a HomeKit Bridge, or a second one if you already have a bridge, and set it to accessory mode for just that camera entity. Name the bridge something like Front Door Cam. The UI path is Settings, Devices & services, HomeKit Bridge, then the Front Door Cam entry, then the camera’s entity options.

The options used here:

  • Video codec: libx264
  • Linked doorbell sensor: event.front_door_ding
  • Linked motion sensor: event.front_door_motion
  • Audio: off

Audio was turned off on purpose. The Home app tile will show video, snapshots, and the doorbell and motion alerts, and it will not carry the camera’s microphone.

On a host with more than one address, or a Docker install that HomeKit cannot see cleanly, set advertise_ip to the address the home hub should use. The placeholder below is 192.168.1.50. Use the LAN address of your server.

A Front Door Cam window in accessory mode. Video codec is libx264, audio is off, the doorbell and motion sensors are the Ring events, and advertise_ip is 192.168.1.50.
One bridge, one camera, accessory mode. The linked sensors are the Ring events.

The same options, written out. camera.front_door stands in for whatever you named the Generic Camera. Include only that camera. The events stay linked from the camera options. They are not added as extra accessories.

homekit.yaml
homekit:
  - name: Front Door Cam
    mode: accessory
    advertise_ip: "192.168.1.50"
    filter:
      include_entities:
        - camera.front_door
    entity_config:
      camera.front_door:
        video_codec: libx264
        support_audio: false
        linked_doorbell_sensor: event.front_door_ding
        linked_motion_sensor: event.front_door_motion

If the bridge was created in the UI, set these as entity options there. The YAML is the same set of options, for a bridge that is configured in configuration.yaml instead.

8 Pair it in the Apple Home app

Home Assistant posts a notification with the HomeKit pairing code. In the Apple Home app, add an accessory, choose More options, pick Front Door Cam, and scan that code. If the notification shows digits instead of a code you can scan, type them in. The code is only on that notification. It is not printed here.

An Apple Home window with the pairing code shown as XXX-XX-XXX, a Front Door tile marked Live, and green checks for doorbell and motion.
After pairing: a live tile, snapshots, and doorbell and motion notifications. The code on this drawing is a placeholder.
pairing.txt
Open the Apple Home app
Add Accessory
More options
Front Door Cam
Scan the code on the Home Assistant notification

Once it is paired you get a live view, snapshots on the tile, doorbell notifications, and motion notifications.

9 Troubleshooting

These are the failures that actually showed up while this path was put together, and the change that fixed each one.

A troubleshooting window with five rows: black video fixed by transcoding to H.264, a stream that never loads fixed by RTSP and TCP, a stuck snapshot fixed by the snapshot stream and cache, an expired token fixed with a new refresh token, and No Response fixed by restarting the home hub and checking mDNS.
Five problems, five fixes. None of them are a new camera.

Black video

A codec mismatch. Ring is H.265, and a client that wanted H.264 drew a black frame. The ring_front_door line has to transcode with #video=h264 and #audio=aac, and the HomeKit entity codec stays libx264.

The Home Assistant stream never loads

Point the Generic Camera stream source at rtsp://127.0.0.1:8554/ring_front_door and set RTSP transport to TCP. A UDP guess, or a URL that is not the transcoded stream, sits there and never starts.

Snapshots do not update

Use the snapshot stream, ring_front_door_snapshot, and keep cache=10s on the still image URL. A frame URL that is not the snapshot source will sit on one image.

The Ring token expired

Refresh tokens die. Get a new one from the go2rtc Ring add flow, put it in go2rtc.yaml in place of the old one, and restart the service. Keep the new token out of git and out of screenshots, and keep the backup habit from step 2.

No Response in Apple Home

Restart the home hub, the HomePod or the Apple TV. If the server and the hub are on different VLANs, mDNS (UDP 5353) has to pass both ways, and advertise_ip has to be an address the hub can actually reach.

While you are chasing the Ring source, the log block can be raised, then put back to info when the stream is healthy again.

go2rtc.yaml
log:
  level: debug
  ring: trace
terminal
sudo systemctl restart go2rtc
journalctl -u go2rtc -f

Back to the guides Home

Comments

Loading comments…