Product Guides

How to Add a Security Camera to Home Assistant: ONVIF & RTSP

integrating security cameras into Home Assistant


Introduction  

Adding a compatible security camera to Home Assistant gives you local access to the video stream, a unified interface for cameras from different brands, and more control over how camera video and events are used in your smart home.

Once connected, the camera can do more than show live video. Depending on the model and integration, Home Assistant may receive motion or person detection events, control supported pan-and-tilt functions, save snapshots or recordings, and use camera activity to trigger lights, alarms, or notifications.

ONVIF is commonly used to add compatible cameras to Home Assistant, while RTSP provides the live video stream. This guide explains the main connection options, how to add an ONVIF-compatible camera, and how to use camera events in practical home security automations.

 

 

Ways to Connect a Security Camera to Home Assistant

Security cameras can connect to Home Assistant in several ways. The right option depends on what the camera supports and whether you need only live video or also detection events, PTZ controls, recording, and device settings.

Connection route

How it works

Typical capabilities

Brand-specific integration

Home Assistant connects through a dedicated integration for the camera brand

Live video, detection events, device status, and model-specific controls

ONVIF integration

A compatible camera is added through Home Assistant's built-in ONVIF integration

Live video, detection events, and PTZ controls, depending on the camera

Direct RTSP stream

The camera's RTSP URL is used as a video source via Generic Camera, FFmpeg, or another compatible platform

Mainly live video; detection events and camera controls usually require a separate integration

NVR or video platform

Cameras connect to Frigate, a brand-specific NVR, or another video system before being added to Home Assistant

Recording, event history, multi-camera management, and object-detection entities

Tip: ONVIF and RTSP serve different roles. ONVIF is an interoperability standard used for camera discovery, media profiles, events, and supported controls. RTSP is a streaming protocol used to carry live audio and video. They can work together: an ONVIF camera may still use RTSP for its live stream.

 

Which Connection Method Should You Use?

  • For beginners, start with a supported brand integration if Home Assistant supports the camera brand. If the camera supports ONVIF, you can add it through Home Assistant's built-in ONVIF integration.
  • Use RTSP when you mainly need live video or want to send the stream to an NVR.
  • Cameras without a suitable native or ONVIF integration may need Generic Camera, FFmpeg, Scrypted, go2rtc, or a custom integration. These options require more manual setup and are mainly useful for stream conversion, codec compatibility, or cameras that are not directly supported.  

 

 

What to Look for in a Home Assistant Security Camera?

A camera may work well in its own app but provide only limited features when connected to Home Assistant. Before buying, check what the device supports through a native integration, ONVIF, or RTSP.  

Integration Support and Local Access

  • Check whether the camera supports a local brand integration, ONVIF, or an RTSP stream.
  • Also confirm that the required feature can be enabled and that the camera provides the IP address, port, and login details needed for setup.

Video Format and Stream Options

  • H.264 is usually the safer choice for Home Assistant dashboards and browser playback.
  • A camera with both a main stream and a lower-resolution substream gives you more flexibility: If available, use the main stream for recording and a lower-resolution substream for dashboard viewing or detection.
  • Check the available resolution, frame rate, and bitrate settings.  

Event Detection and Camera Controls

Features shown in the camera app may not appear in Home Assistant.

  • Confirm whether motion or person detection can be exposed through ONVIF or a native integration.
  • For pan-and-tilt cameras, also check whether Home Assistant can access the PTZ controls.

Power and Network Connection

Choose between PoE and Wi-Fi based on the installation location.

  • PoE cameras provide power and data over one Ethernet cable, but require wired network access and a PoE switch or injector.
  • Wi-Fi cameras offer more placement flexibility but still need a stable signal and a nearby power source.

Battery-powered cameras are generally better suited to event-based clips than continuous live streaming. Reserving the device's IP address in the router can also prevent the Home Assistant connection from breaking after an address change

Tip: Also consider viewing angle, night vision, weather protection, and privacy features for the intended location.

 

 

Which SONOFF Security Camera Fits Your Home Assistant Setup?

SONOFF offers three Wi-Fi security cameras for indoor and outdoor monitoring, including fixed-view and pan-and-tilt models. All three support ONVIF and RTSP. Through ONVIF, Home Assistant can access live video and motion or person detection events. Choose the model based on where you plan to install it and how much coverage you need.

CAM-B1P — For Outdoor Security

CAM-B1P combines 2K video, 180° horizontal pan, IP65 weather resistance, Person Detection and tracking, and multiple night-vision modes, including full-color and infrared.  

✅ Best for: Front doors, yards, garages, driveways, parking lot entrances and exits, warehouse surroundings, and small outdoor business areas.

SONOFF CAM Outdoor Smart Security Camera | CAM-B1P

SONOFF CAM Outdoor Smart Security Camera | CAM-B1P

$29.90

180° Horizontal Pan Control with 2K HD Resolution】Covers a wider area with a rotatable lens for fewer blind spots and more comprehensive monitoring. Featuring 2K HD resolution, capture every detail with sharp, high-definition video for enhanced security and surveillance clarity...

View Product

 

CAM-PT2 — For Pan-and-Tilt Indoor Coverage

CAM-PT2 provides 1080p video, 340° horizontal rotation, 180° vertical tilt, up to six preset positions, and both infrared and full-color night vision.

✅ Best for: Living rooms, nurseries, pet areas, hallways, home offices, and larger indoor spaces.

SONOFF CAM Pan-Tilt 2 Smart Indoor Home Security Camera | CAM-PT2

SONOFF CAM Pan-Tilt 2 Smart Indoor Home Security Camera | CAM-PT2

$24.90

Nearly 360° Panoramic View】With its smooth pan-tilt functionality, the camera eliminates blind spots, allowing you to monitor every corner of your space with ease, ideal for 24/7 home or office security...

View Product

 

CAM-S2 — For Fixed Indoor Monitoring

CAM-S2 offers 1080p live video in a slim fixed-view design, with custom privacy zones and sleep mode for focused indoor monitoring.  

✅ Best for: Entryways, hallways, nurseries, bedrooms, home offices, pet areas, and other fixed indoor locations.

SONOFF CAM Slim Gen2 Smart Home Security Camera | CAM-S2

SONOFF CAM Slim Gen2 Smart Home Security Camera | CAM-S2

$19.90

Privacy Protection – Your Space, Your Rules】Protect your personal space with multiple privacy features: Sleep Mode to turn off video monitoring entirely; Custom Privacy Zones to block out sensitive areas from being recorded...

View Product

 

Home Assistant Feature Support

The table below shows which features are available when CAM-B1P, CAM-PT2, and CAM-S2 are connected to Home Assistant through ONVIF or RTSP.  

Model

Connection Method

Device Discovery

Live View

PTZ Control

Motion / Person Detection Events

CAM-B1P

ONVIF

 — manual script setup required

 — Automation trigger

RTSP

CAM-PT2

ONVIF

— manual script setup required

 — Automation trigger

RTSP

CAM-S2

ONVIF

Not applicable

 — Automation trigger

RTSP

Not applicable

Note: PTZ control for CAM-B1P and CAM-PT2 requires manual script setup. Feature availability may vary by firmware version.

🔎Related guide: See how to integrate SONOFF cameras with Home Assistant, including firmware requirements and PTZ setup.

 

 

How to Add an ONVIF Camera to Home Assistant?

ONVIF is widely used with compatible IP security cameras and may expose video, events, and PTZ controls. The exact setup varies by camera brand, but the basic process is similar for most ONVIF-compatible security cameras.

Before You Start

  • Confirm that the camera supports ONVIF.
  • Note the camera's IP address, ONVIF port, username, and password.
  • Make sure the camera can communicate with Home Assistant over the network.
  • Update the camera firmware if needed.

 

1. Enable ONVIF on the Camera

Open the camera app or web interface and look for ONVIF under the network, advanced, or third-party integration settings. Some models require a separate ONVIF account, while others use the camera's normal login details.

SONOFF Tip: For CAM-B1P, CAM-S2, and CAM-PT2, enable ONVIF and RTSP in the eWeLink app before starting the Home Assistant setup.

 

2. Add the ONVIF Integration

In Home Assistant:
1. Go to Settings → Devices & services. 
2. Select Add Integration
3. Search for ONVIF
4. Choose the discovered camera, or enter its IP address and port manually. 
5. Enter the camera login details and complete the setup. 
Home Assistant can automatically discover many ONVIF cameras. Manual setup is available if discovery fails. 

 

3. Check the Available Entities

Open the new camera device page and check which features are available, such as:

  • Live video
  • Motion detection
  • Person detection
  • Additional camera or control entities

The available entities depend on the camera model, firmware, and ONVIF implementation. PTZ controls may require additional setup on supported models.  

 

4. Add the Live View to a Dashboard

Open an existing dashboard, select Edit dashboard, and add a camera-compatible card such as Picture Entity. Select the camera entity, then test the live view and available controls.

A lower-resolution substream may load faster on the dashboard, while the main stream is usually better for recording.

Using a SONOFF camera? See the complete SONOFF camera integration guide for firmware requirements, ONVIF settings, PTZ scripts, and model-specific features.

RTSP-only camera: Use the stream with Generic Camera, FFmpeg, or a compatible NVR platform.  

 

 

Home Assistant Camera Automations for Better Security

Once connected, motion or person detection can trigger useful actions in Home Assistant. The available options depend on which events and controls the camera exposes in Home Assistant.

Get a Camera Snapshot Notification When Someone Is Detected

Send a phone notification with a camera snapshot when a person is detected near the front door, driveway, or garage. When supported, person detection can reduce alerts caused by rain, shadows, or moving plants.

Turn On Outdoor Lights When Motion Is Detected

Use the camera as a trigger to turn on a porch, driveway, or garden light after dark. Add a short delay to turn the light off again when no further activity is detected.

Record a Short Clip When Someone Approaches

If the camera entity supports recording, save a short clip when the camera detects a person, a door opens, or an alarm is triggered. This is useful for reviewing activity around entrances and other key areas. For continuous recording and event history, use an NVR such as Frigate.

You can also show the live camera view on a Home Assistant wall panel when someone is detected or a doorbell is pressed, making it easier to see who is at the entrance without opening the camera app.  

 

 

Common Home Assistant Camera Problems

Camera Is Not Discovered in Home Assistant

Confirm that ONVIF is enabled and that the camera and Home Assistant can communicate over the network. Then check the IP address, ONVIF port, username, and password. A firewall, VLAN rule, or guest Wi-Fi network may also block discovery.

Live Stream Is Slow or Keeps Buffering

Try a lower-resolution substream for the dashboard. You can also reduce the frame rate or bitrate and check the camera's Wi-Fi signal. Avoid opening the main stream on too many devices at the same time.  

Video Works but Motion Events Do Not Appear

An RTSP stream normally provides video only. Motion or person detection events require ONVIF event support, a native brand integration, or a video platform such as Frigate. Features available in the camera app may not always be exposed to Home Assistant.  

Camera Works in the Brand App but Not Locally

Some cameras rely mainly on the brand's app or cloud service and do not provide local ONVIF or RTSP access. Check the product specifications, app settings, and firmware support before troubleshooting Home Assistant further.  

 

 

Conclusion

Start with a supported brand integration or ONVIF when you need detection events and camera controls. Use RTSP when you mainly need the video stream, and add an NVR such as Frigate when you need continuous recording or local object detection.

Before buying, verify the actual ONVIF or RTSP support, available Home Assistant entities, and any limits on PTZ or event detection. Confirm which features are actually available in Home Assistant, not just in the camera app.

For SONOFF setups, choose CAM-B1P for 2K outdoor monitoring with 180° horizontal pan, human tracking, and IP65 weather protection. Choose the compact CAM-S2 for a fixed indoor view with privacy zones and sleep mode. For wider indoor coverage, CAM-PT2 adds pan-and-tilt movement, preset positions, and infrared or full-color night vision.


 

 

FAQs

Q 1: Can any security camera work with Home Assistant?

Not every security camera can connect directly to Home Assistant. The camera needs a supported brand integration, ONVIF support, an RTSP stream, or another compatible connection method. Some models only work through their own app and do not provide a local video stream or device controls that Home Assistant can access.

 

Q 2: How can I tell if a camera supports ONVIF?

  • Check the product specifications, user manual, or support documentation for ONVIF compatibility.
  • Look for ONVIF settings in the camera app or web interface.
  • Use ONVIF Device Manager (ODM) for a more detailed check. ODM is a free Windows tool that scans the local network for ONVIF devices. It can show whether the camera responds to ONVIF requests, which profiles it supports, available RTSP stream URLs, and any reported PTZ or event capabilities.  

 

Q 3: Do I need Frigate to use a camera in Home Assistant?

Not necessarily. Many cameras can provide live video, detection events, and basic automation via native integration or ONVIF. Frigate is mainly useful when you need continuous recording, event history, multi-camera management, or local object detection.  

 

Q 4: Can Home Assistant record camera footage?

Home Assistant can save snapshots and short recordings from supported camera entities. However, recording reliability and available actions depend on the camera integration and video stream. For continuous recording, event timelines, and easier playback, an NVR such as Frigate is usually a better fit.

 

Q 5: Why can I see the video but not motion events?

The camera may be connected through RTSP, which normally provides only the video stream. Motion or person detection events require support from ONVIF, a native brand integration, or a video platform such as Frigate. A feature available in the camera app may not always be exposed to Home Assistant.  

 

 

 

A ler a seguir

Home Assistant Dimmer Switch: Dimming, Scenes & Automations

Deixe um comentário

Todos os comentários são moderados antes de serem publicados.

Este site está protegido pela Política de privacidade da hCaptcha e da hCaptcha e aplicam-se os Termos de serviço das mesmas.