Step 1: create the camera network
- Create a VLAN or separate network for cameras (for example 192.168.50.0/24) on a router, firewall or managed switch that supports VLANs. Put the PoE switch ports for the cameras into it.
- Give each camera a fixed address (DHCP reservation) and change the default password, then update firmware.
- Make a dedicated viewer user on each camera. The Home Assistant ONVIF page recommends a standard user for Home Assistant.
In plain terms:
- Allow the Home Assistant or go2rtc host to initiate connections to the cameras (RTSP, and the camera's ONVIF port if you use ONVIF; check the camera's settings for the port numbers).
- Block the camera network from reaching the internet.
- Block the camera network from starting connections to the rest of your LAN (replies to the host's connections are normally allowed automatically).
- Cameras often need the time. Either allow NTP to a local server (your router often provides one) or set the camera clock from the host. Without it, timestamps drift.
- Do not port-forward anything to the cameras.
Step 3: find the stream URL
Find your camera's RTSP URL in its manual or the manufacturer's documentation. You can check a URL from the host with ffprobe (part of FFmpeg), which prints stream details:
Code: Select all
ffprobe -rtsp_transport tcp "rtsp://USER:PASSWORD@192.168.50.21/PATH"Step 4: Home Assistant
- ONVIF integration: Settings > Devices and services > Add integration > ONVIF, then enter the camera IP, ONVIF port and the viewer user. The integration needs ffmpeg and creates entities for H.264 profiles, and has an RTSP transport option (tcp, udp, udp_multicast, http). If a stream is unreliable, try tcp. It also supports ONVIF events (motion and similar) where the camera provides them.
- go2rtc: Home Assistant's go2rtc integration connects to a go2rtc instance to provide a WebRTC proxy for cameras. The HA docs say it is set up automatically with default_config on Home Assistant OS and Container installs. The debug UI is off by default, and the docs say to enable it only while debugging, since it exposes port 11984.
If you want one camera connection restreamed to several viewers (so the camera serves a single stream), run go2rtc yourself (Docker image or binary, see its README). A minimal config:
Code: Select all
streams:
front_main: rtsp://USER:PASSWORD@192.168.50.21/PATH
front_sub: rtsp://USER:PASSWORD@192.168.50.21/SUBPATHCode: Select all
api:
listen: "127.0.0.1:1984"
rtsp:
listen: "127.0.0.1:8554"Step 6: remote viewing
Use a VPN into your network (WireGuard or similar), or Home Assistant's own secured remote access, not port-forwarding. Make sure your Home Assistant login uses a strong password and two-factor authentication.
Checks
- From a device on the camera VLAN, confirm you cannot reach the internet or your other devices.
- Confirm the cameras still stream after a router reboot.
- Check the host's CPU use. Use sub-streams for live view where possible.
Question for the group: what router or firewall are you using for camera VLANs, and did you hit any problems with discovery, NTP or two-way audio across the VLAN boundary?