ONVIF
The ONVIF integration allows you to use an ONVIF Profile S conformant device in Home Assistant. This requires the ffmpeg integration to be already configured.
Configuration
To add the ONVIF device to your Home Assistant instance, use this My button:
ONVIF can be auto-discovered by Home Assistant. If an instance is found, it will be shown as Discovered and can be set up right away.
Manual configuration steps
- Browse to your Home Assistant instance.
- Go to Settings > Devices & services.
- In the lower-right corner, select Add integration.
- From the list, select ONVIF.
- Follow the instructions on screen to complete the setup.
It is recommended that you create a user on your device specifically for Home Assistant. For all current functionality, it is enough to create a standard user.
Configuration notes
大多数 ONVIF 设备支持多个音频/视频配置文件。每个配置文件提供不同的图像质量,或者对于 NVR,提供不同的连接摄像机。此集成将为所有兼容配置文件添加实体,视频编码设置为 H.264。通常,第一个配置文件具有最高质量,并且是默认使用的配置文件。但是,您可能想使用较低质量的图像。您可以通过 Home Assistant UI 禁用不需要的实体。
Options
To define options for ONVIF, follow these steps:
-
In Home Assistant, go to Settings > Devices & services.
-
If multiple instances of ONVIF are configured, choose the instance you want to configure.
-
On the card, select the cogwheel
. - If the card does not have a cogwheel, the integration does not support options for this device.

-
Edit the options, then select Submit to save the changes.
Snapshots
某些相机无法生成具有较大流大小的可用快照。
默认情况下,集成将仅启用第一个 H264 配置文件的相机实体。如果您无法获取工作快照:
- 如果其他相机实体可用于其他配置文件,请尝试启用这些实体。
- 将“额外 FFmpeg 参数”设置为“-pred 1 -ss 00:00:05 -frames:v 1”,以使快照在 5 秒后拍摄到流中。
Supported sensors
此集成使用 ONVIF pullpoint 订阅 API 将事件处理到传感器中,这些传感器将自动添加到 Home Assistant。 以下是当前支持的事件主题及其创建的实体的列表。
为了帮助开发此集成,请为“homeassistant.components.onvif”启用“信息”级别日志记录,并在 GitHub 上针对显示“没有注册事件处理程序”的任何消息创建问题。
如果您在使用该传感器时遇到问题,请参阅故障排除部分。
Action onvif.ptz
如果您的 ONVIF 摄像机支持 PTZ,您将能够平移、倾斜或缩放摄像机。
Supported switches
此集成使用 ONVIF 辅助命令和成像服务通过开关实体将某些设置和信息发送到摄像机。以下是当前支持的交换机的列表。
Troubleshooting
症状:错误消息:“未找到可用的摄像头”
ONVIF 集成显示错误消息“未找到可用的摄像机”。
Resolution
更新摄像机配置以输出至少一个 H.264 格式而不是 H.265 格式的视频流。执行此操作的一种选择是将辅助流设置为 H.264,同时将主要流保留为默认 H.265。
Cause
许多较新的摄像机,特别是那些受益于 H.265 改进的视频编码的高分辨率摄像机,默认支持 H.265 (HEVC),而 ONVIF 集成则寻找 H.264 (AVC) 视频流来查找摄像机。

