Dahua IP camera component

Ohh Man sorry. I did not see that, weird I did not get the notification. Anyway I’m new to HA so its probably going to take me a long time to get this working. I tried openhab at first but its so much more complicated and at least HA is a lil more straightforward. I still cant figure out how to get custom components added to my HA mostly because Samba wont start. SO I gotta get the sorted and then I’m onto this.

Are you using Core or not? AKA do you have an “add-on” store?
If you do, I don’t know anything about how all that works… because I am on the “Core” version that doesn’t have the add-on store.

Since you’re talking about Samba and custom component, I expect that you are using the add-on store.
Otherwise, I would suggest HACS for custom components… it is crazy easy to manage them that way (for non-add-ons).

Cheers!
DeadEnd

THanks. I am on HassOS/HASS.IO VM image under synology virtual machine manager. So yes I have addon store and was trying to install HACS ironically that is why I am trying to get samba so I can dump the hacs install into the samba share but I cant get samba to work so I am stuck.

Samba lets me login with the credentials but then fails to show the shares. Its as if its rejected but I get no error in the log. It says login successful. I found this but i cant apt-get to install this. see: https://www.youtube.com/watch?v=afHieDHizjc

Hi @GaryOkie could you share your amcrest setup? I have 3 dahua and an onvif camera on dahua nvr and would like to use tripwire. (Or is amcrest still limited to motion only?)

Thanks, Roger

Hi @roumen - the amcrest component currently doesn’t support the NVR as it can’t specify channel #'s. So you need to be sure each camera is directly accessible by it’s IP address.

The config is straightforward:

stream:

amcrest:
#   Dahua IPC HDW5231
  - host: 192.168.x.xxx
    name: "Driveway"
    username: !secret cam_id
    password: !secret cam_pw
    resolution: high
    stream_source: rtsp
    port: 80
    binary_sensors: motion_detected

The amcrest component provides a binary sensor for automations, for example: binary_sensor.driveway_camera_motion_detected

But in order to actually enable motion detection, it has to first be enabled in the camera itself, then by using the HA camera service:

service: camera.enable_motion_detection
data:
  entity_id: camera.driveway

The latest Amcrest component has improved responsiveness for motion detection now that it is subscribing to motion events as they happen rather than polling for them which had a bit of a delay. The component won’t tell you what specific event occurred (tripwire, motion, etc.) so events you don’t want need to be disabled in the camera.

Amcrest cameras don’t have tripwire functionality to my knowledge but I’m pretty sure the python-amcrest code will still raise a motion event when they occur on Dahua’s that have it enabled.

1 Like

Thanks for quick reply, I will give it a try. Too bad nvr is not supported yet but I think I can access the camera’s directly (different subnet)

hi guy!

I have just integrated Dahua camera into hass via ovif.

however the camera warnings do not work.

Has anyone ever used or had any idea!

thanks!

Previously issues with Timezone reporting from Dahua firmware was causing me issues trying to use Onvif integration. I stepped back to using Amcrest component until I heard it was working.

I don’t have any Dahua IP cameras, but I’m told from people who do that the amcrest integration works just as well with them as they do with Amcrest cameras. There are some issues with recent Amcrest camera models & firmware versions since Amcrest changed the interface without documenting those changes, but that’s a separate issue.

If you’re still around, would you consider marking this topic as solved, since pretty much Dahua cameras are now supported via the amcrest integration? If so, find an appropriate reply and click on image

Thanks!

Hi @pnbruckner - regarding:

I’ve been using the Amcrest integration for my Dahua cameras a long time, but it does not provide me with HA alerts for tripwire motion detection (among other advanced IVS options). That is why I think this feature request should stay open. Ideally, the goal I think is the Amcrest integration and Dahua could be one in the same and named as such in the docs with few significant caveats. (I do recognize recent Amcrest undocumented changes from the API may make this goal unattainable).

It should be a relatively straightforward update to subscribe to CrossLineDetection (tripwire) in addition to VideoMotion events.

It could be hardcoded to check for any motion/IVS event and return as an attribute what type it was. Or there could be a new configuration option (following how Skybell works) to be able to specify:

binary_sensor:
  - platform: amcrest
    monitored_conditions:
      - button
      - motion
      - tripwire
      - etc...

I snuck “Button” events in there which relates to the Amcrest (or Dahua) doorbells. I have just today figured out how to listen for button events and have a working python script! So this update could solve another highly requested feature as well in python-amcrest.

Following are the Dahua event codes as returned by an app you wrote, slightly modified…


2020-08-18 10:29:05 '\r\nCode=VideoMotionInfo;action=State;index'                                                                                                                             
2020-08-18 10:29:05 '\r\nCode=VideoMotion;action=Start;index=0;data={\n   "RegionName" : [ "Driveway" ]\n'                                                                                    
2020-08-18 10:29:05 '\r\nCode=VideoMotionInfo;action=State;index'                                                                                                                             
2020-08-18 10:29:05 '\r\nCode=VideoMotion;action=Stop;index=0;data={\n   "RegionName" : [ "Driveway" ]\n'                                                                                     
2020-08-18 10:29:08 '\r\nCode=CrossLineDetection;action=Start;index=0;data={\n   "Class" : "Normal",\n   "DetectLine" : [\n      [ 4605, 1823 ],\n      [ 7317, 5639 ],\n      [ 5388, 8045 ],
\n      [ 1329, 6684 ],\n      [ 3240, 2066 ],\n      [ 4660, 1872 ]\n   ],\n   "Direction" : "RightToLeft",\n   "EventSeq" : 2,\n   "FrameSequence" : 5947404,\n   "GroupID" : 2,\n   "Mark" 
: 0,\n   "Name" : "Rule1",\n   "Object" : {\n      "Action" : "Appear",\n      "BoundingBox" : [ 4480, 1280, 5072, 2704 ],\n      "Center" : [ 4776, 1992 ],\n      "Confidence" : 0,\n      "
FrameSequence" : 0,\n      "LowerBodyColor" : [ 0, 0, 0, 0 ],\n      "MainColor" : [ 0, 0, 0, 0 ],\n      "ObjectID" : 171,\n      "ObjectType" : "Human",\n      "RelativeID" : 0,\n      "So
urce" : 0.0,\n      "Speed" : 0,\n      "SpeedTypeInternal" : 0\n   },\n   "PTS" : 43147700720.0,\n   "RuleId" : 0,\n   "Source" : 36139320.0,\n   "Track" : null,\n   "UTC" : 1597746548,\n  
 "UTCMS" : 531\n'                                                                                                                                                                             
2020-08-18 10:29:08 '\r\nCode=IntelliFrame;action=Pulse;index=0;data={\n   "Action" : "Start"\n'                                                                                              
2020-08-18 10:29:11 '\r\nCode=CrossLineDetection;action=Stop;index=0;data={\n   "Class" : "Normal",\n   "DetectLine" : [\n      [ 4605, 1823 ],\n      [ 7317, 5639 ],\n      [ 5388, 8045 ],\
n      [ 1329, 6684 ],\n      [ 3240, 2066 ],\n      [ 4660, 1872 ]\n   ],\n   "Direction" : "RightToLeft",\n   "EventSeq" : 2,\n   "FrameSequence" : 5947404,\n   "GroupID" : 2,\n   "Mark" :
 0,\n   "Name" : "Rule1",\n   "Object" : {\n      "Action" : "Appear",\n      "BoundingBox" : [ 4480, 1280, 5072, 2704 ],\n      "Center" : [ 4776, 1992 ],\n      "Confidence" : 0,\n      "F
rameSequence" : 0,\n      "LowerBodyColor" : [ 0, 0, 0, 0 ],\n      "MainColor" : [ 0, 0, 0, 0 ],\n      "ObjectID" : 171,\n      "ObjectType" : "Human",\n      "RelativeID" : 0,\n      "Sou
rce" : 0.0,\n      "Speed" : 0,\n      "SpeedTypeInternal" : 0\n   },\n   "PTS" : 43147700720.0,\n   "RuleId" : 0,\n   "Source" : 36139320.0,\n   "Track" : null,\n   "UTC" : 1597746548,\n   
"UTCMS" : 531\n'                                                                                                                                                                              
2020-08-18 10:29:11 '\r\nCode=IntelliFrame;action=Pulse;index=0;data={\n   "Action" : "Stop"\n'

I have no idea what the “IntellifFrame” event refers to, but it always occurs in conjunction with tripwire. Just included for completeness, and can surely be ignored.

1 Like

Not sure if its working yet, but did you try the ONVIF integration?
I think its suppose to work with events…

No, I have not tried the latest ONVIF integration, but will when I get a chance.

There is a new version on ipcamtalk from the dahua API.
https://ipcamtalk.com/attachments/dahua_http_api_v2-76-for-ipcamtalk-_com-pdf.61808/
Current version from dahua that needs a NDA is DAHUA_HTTP_API_V2.84.