WebRTC Camera. It can reduce the latency of an RTSP stream to under one second (even to the millisecond range), and it supports two-way audio.

Below is a detailed installation and usage tutorial:


Step 1: Preparation

  • Home Assistant is already installed and running.
  • HACS (Home Assistant Community Store) is installed.
  • If HACS is not installed, you need to install it first; it is an essential tool for managing third-party plugins.

The RTSP address of the camera (for example: rtsp://admin:password@192.168.1.x:554/stream), or a camera entity (Entity ID) already added in HA.


Step 2: Install the integration (via HACS)

  • Open HACS in the left-hand menu of Home Assistant.
  • Click Integrations.
  • Click Explore & Download Repositories in the bottom right corner.
  • Enter WebRTC in the search box.
  • Find WebRTC Camera (author AlexxIT) and click into it.
  • Click Download in the bottom right corner to download it.
  • After the download completes, you must restart Home Assistant.

Step 3: Configure the integration

  • After the restart completes, go to Settings -> Devices & Services in the left-hand menu of HA.
  • Click Add Integration in the bottom right corner.
  • Search for WebRTC Camera.
  • Click it to add it. Usually no extra configuration is needed; just click submit. It automatically installs and runs the go2rtc server in the background (this is the core streaming service).

Step 4: Use it on a dashboard (frontend card configuration)

This is the most critical step: you need to add the camera feed to your Lovelace dashboard.

  • Go to your dashboard page and click the three dots in the top right corner -> Edit Dashboard.
  • Click Add Card in the bottom right corner.
  • Scroll to the bottom and choose the Manual card (or search for Custom: WebRTC Camera).
  • Enter the following YAML configuration in the code editor.

Scenario A: use the RTSP address directly (recommended, lowest latency)

If you know the camera’s RTSP address, enter it directly; the result is the best.

type: custom:webrtc-cameraurl: rtsp://admin:password@192.168.1.10:554/h264/ch1/main/av_stream

(Note: please replace url with the real address of your own camera)

Scenario B: use an existing HA camera entity

If you have already integrated the camera in HA through Onvif or another method, you can use the entity ID directly.

type: custom:webrtc-cameraentity: camera.living_room_camera

(Note: replace entity with the camera entity ID in your HA)

Scenario C: advanced configuration (PTZ control, style adjustments)

If your camera supports pan-tilt-zoom (PTZ), you can add control buttons:

type: custom:webrtc-cameraurl: rtsp://admin:password@192.168.1.10:554/stream
# 开启 PTZ 控制 (需要摄像头支持 Onvif 并且 HA 已配置)
ptz:
 service: onvif.ptz
 data_left:
 entity_id: camera.my_camera
 pan: LEFT
 data_right:
 entity_id: camera.my_camera
 pan: RIGHT
 data_up:
 entity_id: camera.my_camera
 tilt: UP
 data_down:
 entity_id: camera.my_camera
 tilt: DOWN

Step 5: Advanced topics and remote access (important)

On the local network, the configuration above is usually plug and play. But if you need to access your home HA from outside (using mobile data or office Wi-Fi) and view the low-latency stream, you will run into NAT traversal issues.

The WebRTC protocol relies on UDP connections, and routers usually block these connections.

Solution: configure port forwarding

This integration uses port 8555 for video streaming by default.

  • Log in to your router’s admin panel.
  • Find the Port Forwarding settings.
  • Add a rule:
  • External port: 8555
  • Internal IP: the IP address of your Home Assistant
  • Internal port: 8555
  • Protocol: TCP + UDP

If you run HA in Docker, make sure the 8555 port is mapped when starting the Docker container (-p 8555:8555/tcp -p 8555:8555/udp).


Common troubleshooting (FAQ)

1. The image shows “MSE” instead of “WebRTC”, and there is latency?

  • This means the WebRTC connection failed and it fell back to MSE mode. It is usually caused by a network problem (such as the UDP port not being open on the external network) or an unsupported browser.
  • H.265 encoding issue: WebRTC does not support H.265 (HEVC) encoding in most browsers (especially Chrome/desktop). Please go into the camera’s admin settings and change the video encoding to H.264.

2. Cannot view on the mobile App?

  • Make sure the Home Assistant App is updated to the latest version.
  • On iOS, check whether local network permission is enabled.

3. How do I enable two-way audio?

  • This requires the camera to support the two-way audio standard, and the configuration is relatively complex (usually you need to edit the go2rtc.yaml file). If you only need to view the image, the basic configuration is enough.

4. The image is always a green screen or has artefacts?

  • 90% of the time it is because the camera outputs H.265. Please be sure to change it to H.264.

Summary

The core workflow is: install via HACS -> restart -> add the integration -> add a custom:webrtc-camera card to the dashboard. Once configured successfully, you will find the image is almost real-time, and the experience is a qualitative leap forward.

相关新闻

cloud@haiots.com

QQ
微信