Dahua and Amcrest integration for cameras and doorbells

I wrote an integration for Dahua and Amcrest cameras and doorbells which likely also works with other brands that are Dahua hardware under the hood.

All functionality is local-only and based on real-time events pushed to Hubitat with no polling.


The code and readme are available here:

I recommend installing via HPM (search for "dahua").

I support the native Hubitat capabilities for ImageCapture (snapshots), MotionSensor (video motion), and PushableButton (for doorbells).

I also support cross line detection, cross region detection, and object detection (if supported by your camera). Other events and capabilities may be able to be added by request.

Thanks to @techbill for all of their testing, feedback, and suggestions. And thanks to @mluck for moral support.

11 Likes

Thank you for making this possible. I finally can get rid of that battery operated doorbell sensor!

And the trip line event trigger is a benefit too. I have camera aiming down long driveway and events will be able to alert me when in camera trip line detection is crossed!

Thanks! Happy New Year!

3 Likes

I successfully installed this and it works with my AD110 Amcrest doorbell camera.

How do I get my doorbell camera to take a photo once motion is detected and show it on my dashboard? Maybe a driver with an attribute?

Is there a way I can have the doorbell camera take a photo save it, then create an "image" dashboard tile that shows the saved photo?

Basically when someone approaches my door Iā€™d like the doorbell camera to take a photo that displays on my dashboard.

Thank you for your help. Sorry Im new at this been working on a way to do this for hours now.

There are two steps:

  1. You need to automate the step of calling take on the camera. Here is a post where I described how to do that for simple motion. You could use specific values as a trigger on any attribute from any sensor (whether on this device or another device, for example specific line crossed or object detected) to do this step. Ubiquiti Unifi Protect cameras - #152 by tomw

  2. You need a way to serve the saved image from this virtual device up to your dashboard or webpage. I made an app here that can do that. I'm revamping some features, so full documentation on this app isn't yet complete. Let me know if you have any trouble setting it up. Ubiquiti Unifi Protect cameras - #127 by tomw

1 Like

You are amazing!!
This worked great!

For some reason I couldn't get my Amcrest Doorbell camera to detect motion and take a picture, So instead I created a Rule for it take a picture ever 2 seconds.
Then I added the picture link from Image Server and set the tile to refresh every 2 seconds.

Looks so good! Now I have HD "footage" (every 2 seconds) from my Doorbell camera on my dashboard.

Thank you again!!!

Edit: So, If i take a picture every 2 seconds, my database seems to fill up quickly and the HE freezes. I need to figure out how to prevent this.

1 Like

This is awesome Tom, Thank You.
So I have a Lorex setup, which is Dahua, however Lorex has the cameras on the NVR's subnet which is a 10.1.1.120, .1.1.121, etc. and wondering what I need to do to allow your app access to the feed. PFSense is my router

EDIT- Dam you're good. It picked up every camera even on another subnet, with my Lorex Camera System

1 Like

I added two dahua cameras and setup RM to take a snapshot only when motion occured on a C5. The free memory dropped significantly and the DB went way up. I have a rule setup to reboot the hub if the free memory drops below 200K and it rebooted 3 times in 5 hours. I also noticed the driver automatically assigns the camera's serial number as the device name. If I rename the device it goes back to the default name whenever the hub reboots. When I use the clear image option it sometimes locks up the hub and the hub reboots.

I could be wrong but I don't think this integration is ready for prime time.

1 Like

Yeah you are correct. I had the same issue. Memory usage and DB are skyrocketing, I think it may have to do with the image filename, FileServer creates extremely large filenames (thousands of characters) for images.

Try reducing the event history on the virtual device. What do you have it set to now?

The images are large and are stored in the event history, so it will add to the db if you store a long history. Mine is set to 11 and I have no issues with performance or storage.

This was a design decision I made to always set the virtual device name to the machine name of the camera when the driver Initialize happens.

EDIT: I changed the code to NOT modify the device names, so it will always remain as whatever you manually set it to. If others prefer the original behavior, I can make it a configurable option to behave whichever way is preferable.


See my comment above on event history length settings. That should hopefully help with the db usage issues you all are seeing. This mechanism for storing images is identical to what I have used on my UniFi Protect integration for years, so I'm confident we can work through these hiccups.

1 Like

My event and state history size are both set to default to 11 and I'm still seeing the same issues with free memory and db size.

Screen Shot 2023-01-02 at 1.05.26 PM

If you go to the Events history on the virtual device, how many images do you actually see in the history? How often are you taking snapshots based on your motion trigger?

I had this setup on my front door and driveway camera and let it run through the night. Neither camera triggered all night so there were no snapshots. I deleted both camera devices this morning when I noticed my hub had rebooted 3 times during the night so I can't go to the event history.

1 Like

Interesting, I have another theory on what may be going wrong. I'll PM you to troubleshoot further, if you are game.

Quick question: do you recall seeing any events ever on the camera when you were first setting this up?

1 Like

I did see events when I manually triggered the take command.

1 Like

I think we got these issues sorted out with a Hubitat platform update and a little bit of testing on @Vettester's system.

To anyone that installed via HPM, please use the 'repair' option to pick up a couple of small changes I made.

1 Like

This is really awesome and the timing is perfect!!!

After Arlo's announcement that it's going to brick four of my six cameras (Original Pros) in April, 4 months from now, barely 5 years after I bought them, I need something to replace it, quickly. I may end up with a full blown Blue Iris system, but initially your driver might be enough!

P.S. Anyone want to buy my remaining two (Arlo Pro-2) cameras and doorbell? They might not get bricked until next year or even the year after that. I can hear it now:

Me: "Let the bidding start: Do I hear a dollar each? A dollar for all 3?"

Customer: "OK, $1 for all three. Oh wait- I have to pay shipping too? Nevermind."

1 Like

I ran this through the night and even though it triggers the way it is supposed to there still appears to be a memory leak issue. Here's a screenshot of my system stats with the driver enabled and again with it removed.

Kudos here, I've spent the last couple of weeks trying to figure out how I get the ArmCrest AD110 to integrate with HE. I was looking at MQTT as well as Alexa and then finally came across this.

Off to order one now. Thanks for your efforts here!

1 Like

@tomw Thanks for this. I'm looking forward to getting it installed. But, so far, no joy.

Hubitat is on the 192.168.1.0/24 net and my cameras are on the 192.168.50.0/24 subnet, e.g 192.168.50.61. Installing the app, I get this error:

Please advise. Thanks!

Download the Hubitat app