Any one know how can i add NVR IP camera Dahua

You’re very welcome adamg!

Yeah, the Starlights are really awesome, especially for their night vision.

Currently, I am still struggling to find a way to get Dahua motion/IVS alerts to Hass.io. I’ve looked into all the python scripts other users have implemented but they don’t work on Hass.io because the dependencies they require aren’t possible to install.

Hey thanks!
if you put the address directly on the browser , will it work or no?
ONVIF is enabled but when i use the link it is not working
do you have live video or only snap shots?

Poratnir,

It is live video stream using the ONVIF protocol via the ffmpeg component. Hassio also has a complementary onvif camera component, but I had trouble with Digest authentication using it the last time I tried it many months ago.

if you are referring to “rtsp://…” as the link, then no, it will not normally work directly in a browser. You can test live streaming using VLC. There is even a VLC ActiveX option if you really want to display the stream in an IE browser without using HA. But why go through that trouble when it is so easy to use HA directly?

How can i use HA directly…
I have Dahua HFW1320SP-W and i cannot get it to work with HA…
i am using Hassbian not HASSIO…
how to install vlc?

Poratnir,

I only mention VLC as a tool for displaying video streams that can be used with any camera supporting ONVIF, including probably all recent Dahua cameras. For installation guides on Windows, Linux, IOS, Android, please refer to the VLC website.

VLC has nothing do do with Home Assistant’s ability to display Dahua live video directly. For that, you need to add the ffmpeg component and corresponding rtsp string to the HA configuration file I’ve shown previously.

For HASSIO, the underlying dependencies are already installed. For other HA implementations (which I don’t use), please refer to the ffmpeg component documentation for installing ffmpeg software. Sorry, I can’t help you with that for Hassbian.

Hi @GaryOkie,
i’m trying to get my dahua cameras into a lovelace card by using your config. I have just installed hassio for the first time and I am learning so much I can right now.

I put this in my configuration.yaml

I get this message when checking the config:

   *Invalid config for [ffmpeg]: [camera 1] is an invalid option for [ffmpeg]. Check: ffmpeg->ffmpeg->camera 1. (See /config/configuration.yaml, line 15)*

Could you tell me what i am doing wrong? or guide me in the right direction?

Hi @Patrik_Gustavsson - welcome to the community!

You’re close… leave out the “ffmpeg:” You will be using the camera integration with ffmpeg as the platform, like so:

camera 1:
  - platform: ffmpeg
    name: "Front Yard Camera"
    input: rtsp://<admin:password>@192.168.0.108:554/cam/realmonitor?channel=1&subtype=0

This is a simpler RTSP input stream than an earlier example I gave years ago but it works fine for Dahua or Amcrest IP cameras. The IP address can be either direct to individual cameras or it can be to an NVR and the channel=# specifies which camera.

If your cameras are individually accessible by IP, you can also use the Amcrest component instead of ffmpeg. It’s main limitation is that it does not support channel #'s when connecting to an NVR.

Tip: next time you need to post YAML, it’s best to paste is as text and select it with the “</>” code markup.

Hi Gary, sorry for the late reply.

I managed to get this to work using this code:

camera 3:
  - platform: ffmpeg
    name: "Garaget"
    input: rtsp://user:[email protected]:554/cam/realmonitor?channel=3&subtype=1

But I have a few questions if you don’t mind :slight_smile:

I use this code to show the cameras in lovelace

cards:
  - aspect_ratio: 0%
    camera_image: camera.framsida
    entities: []
    image: 'https://demo.home-assistant.io/stub_config/kitchen.png'
    type: picture-glance
  - aspect_ratio: 0%
    camera_image: camera.baksida
    entities: []
    image: 'https://demo.home-assistant.io/stub_config/kitchen.png'
    type: picture-glance
  - aspect_ratio: 0%
    camera_image: camera.garaget
    entities: []
    image: 'https://demo.home-assistant.io/stub_config/kitchen.png'
    type: picture-glance
  - aspect_ratio: 0%
    camera_image: camera.gardsplan
    entities: []
    image: 'https://demo.home-assistant.io/stub_config/kitchen.png'
    type: picture-glance
type: horizontal-stack

When I click one of the cameras it get stuck on loading.
Skärmavbild 2020-08-06 kl. 21.55.00

Why is that?

Do you know if there is a way to get the motion detection from the nvr or cameras to home assistant like a sensor?

I’m not seeing anything wrong with your picture_glance cards, even though the demo image isn’t needed and will just be ignored since you have camera_image specified too.

Have you checked your logfile for errors? Do you have “stream:” specified in your config?

The ffmpeg platform doesn’t support motion detection directly. You could use the Amcrest integration instead. It will work with Dahua cameras and will support motion detection. It does not, however, support NVR’s.

Hope this helps!

I have 5 Dahua IP cameras, all integrated into HA via the ONVIF protocol, I’m at work at present so cant give you much more info but if you want more I can look tomorrow when I’m home

Hi, Do you have some time to show me how to setup this?
Do you use a dahua nvr?

Yes I’ll help wherever I can

I do NOT have any entry in my config file for the cameras.
Thy are all discovered by Home Assistant using the ONVIF Integration.
I remember originally only 1 or 2 were discovered and I could not understand why the rest were not so I searched through all the settings on each camera the check they matched the discovered ones but still they would not be discovered. Eventually they just appeared 1 day (I must have changed something without noticing.
In Settings/Network/Port/ONVIF: I have ONVIF authentication OFF, what is yours set too?
Try enabling any of these if you haven’t already
Settings/Event/Video Detection/Motion Detection
Settings/Event/Video Detection/Video Tampering
Settings/Event/Video Detection/Scene Changing
Then do a restart of your Home Assistant
I’m running Home Assistant/hassio on a Raspberry Pi 4+ with an ethernet cable connection to my router and all my cameras are connected via ethernet cable back to my router too (using a few switches dotted around the house)
My NVR is also connected to my router via ethernet cable.

Just an FYI - VLC is able to display H.265 since version 3.0 just fine. So can HA with the Safari browser (or Edge & IE of there is hardware support for H.265).

So the problem is not HA, but is simply due to most browsers not supporting H.265, therefore H.264 is indeed the way to go. You can refer to this link which shows the compatibility matrix…
https://caniuse.com/hevc