Dahua and Amcrest integration for cameras and doorbells

Wow...awesome work on both this, and the image server!

No issues getting an older Amcrest PTC, and two newer 4K cams up and running on motion triggers.

1 Like

I've tried the single cameras and the app discovery. The DVR is on the same network as the router but the cameras are a 10.1.1.XXX.

It looks like the NVR supports rtsp://commands

1 Like

The cameras have to be routable from the Hubitat hub in order for this to work. Is it possible to put them in the same subnet as Hubitat or to change your networking settings to make that possible?

The subnet for the DVR and the Router are both 255.255.255.0

The cameras are on a completely different network, and you won’t have access to that network from Hubitat as the DVR switch ports will not allow this.

Additionally, the addin is not designed for a Lorex DVR.

That is the subnet mask, but I assumed from your earlier post that while the cameras are on 10.1.1.xxx (and possibly behind a NAT?), the Hubitat hub was on a different network.

Can you ping a camera from a PC on your network? And can you ping Hubitat from the same PC?

I saw this reference which might help: https://d2zri47w41ywm3.cloudfront.net/downloads/security-nvr/N864/manual/WEB/EN/LX501129.xml.html#styler-id1.3.4.9.1

The Lorex NVRs (I've set up a few for commercial clients) have their own switch integrated to the NVR which is separated from the host network by using a private network. The unit has a WAN port, configured to the host network. That's it. This is why Hubitat won't see the camera's attached to the NVR network ports. For viewing etc, you attach to the NVR, and only cameras networked outside (not connected to NVR network ports) would be accessible from Hubitat (if the driver worked for this camera firmware). Last time I looked, you can't change the NVR setup.

You can add LOREX cameras on the host network, but you need to set static IPs appropriate to that network on each camera, then add it to the NVR. I've had to do to this a few times when there were no available network ports on the NVR. The systems I've configured have been in the 20-30 camera range...mostly 4K.

You would need to disconnect the cameras from the NVR (10.1.1.x), and plug them into another switch connected to your router, with the NRV WAN port connected to that 2nd switch (let's say your home router is setup as 192.168.10.x). Then you would need to configure each camera with a static IP on your network (192.168.10.x), and re-add them to your NVR with the new IP addresses. Then the cameras and Hubitat would be on the same subnet and you could try this integration.

This is not an ideal setup with a lot of 4K cameras recording constantly as now they are all recording to the NVR via the one WAN port on the NVR. This is why the NVR ports are on their own subnet on the NVR..to segment traffic.

1 Like

This is a very detailed response and answers alot of my questions. Thank you very much.

1 Like

I have two Amcrest cameras that I was using with my Synology NAS and the package "Surveillance Station" to email reports of any motion detections. It works well.
Then, just yesterday, I discovered this device. Installed and configured it as documented with no problems for one camera. Took a couple of test snaps with it and have created a Rule Machine to test its reporting.

Below is the text device information and the log entry I am getting on a trigger.
Would be greatly appreciative of any suggestion to resolve the log entry.

Dahua/Amcrest Camera
0.9.2 - tomw - Store images from 'take' in File Manager. More connection reliability.

[app:1007] (http://192.168.1.166/logs#) 2023-01-30 19:05:25.629 [error]
(http://192.168.1.166/logs#) java.lang.ArrayIndexOutOfBoundsException: 1 on line 138 (method discoveryPage)

Thanks.
This is a really neat device. I'm sure the error is on my side, I just don't see what i have done incorrectly.

SK!

1 Like

That error log appears to be from an app, not a driver. Which app is app:1007 on your system? I am guessing that it is from my "Dahua camera discovery" app, but please correct me if I'm wrong.

That app is optional, and as you said cameras can be added manually. If you only have two, and if you want to get up and running faster, I'd just create them manually.

I'll PM you to see if we can figure out what is not working in the discovery process.

I like that you're using 10.1.1.x for your IP range. Mine is 10.0.1.x. :slight_smile: WAY easier than remembering and typing "192.168.0.xxx". Why is that even used?

It seems it working. I just tested the camera and got both my PushOver message and the email from my NAS. Just as planned.

Your driver works perfectly. My error and as you pointed out the wrong log item in my posting.

Also tried your suggested URL test as in the email.

I get a simple "error" when I use the suggested URL format.

Mine as pasted into the address field, but with my actual username and password:
http://dink:foobar@192.168.1.61:80/cgi-bin/deviceDiscovery.cgi?action=attach

Don't know what you expected. But all seems well now.
I did install the lasted Hubitat software and of course it rebooted.

Again, all is well and thank you for the wonderful device.

SK!

It seems like the discovery functionality across vendors and camera models is inconsistent, which is unfortunate. The main issue people have had with this integration has been related to the auto-discovery, but the driver and virtual devices seem to generally be working well.

So, for anyone that has discovery issues, feel free to PM me if you want to try to troubleshoot it. But if you have a small number of cameras, keep in mind that the discovery app is strictly optional and that it may be quicker to just create the virtual devices yourself!

I'm glad your setup is working as intended, and thanks for the kind words in your feedback.

I'm having the same problem when attempting to install the Dahua camera discovery app. When I do that, it pops up the screen for the IP address and port, and user and password. I enter those and press "Next" and get:

Unexpected Error

An unexpected error has occurred trying to load the app. Check Logs for more information.

Error: 1

The entry in the log says:

java.lang.ArrayIndexOutOfBoundsException: 1 on line 138 (method discoveryPage)

I looked at the line of code referenced -

  def stripped = it?.split('deviceInfo\\[')?.getAt(1)

But my programming experience is with C (pre C++), Pascal/Delphi, a bit of javascript almost 20 years ago, and lately (and very lightly) Python, and none of them help me understand what this line is doing. But I can apply code tweaks directly and provide good test feedback, if it isn't failing for you and you need data from running it at a place where it is.

So, any ideas?

I just installed an Amcrest AD410 to replace my now obsolete Arlo doorcam, and would love to turn off their lame phone app's notifications so I can get notified through Hubitat's far more flexible ways.

We were posting at the same time, but check my reply above yours. The discovery app is optional, and if you only have one (or a few) cameras that you'd like to integrate, please try just creating the virtual devices directly.


BUT if you want to try to get it working, please PM me with the output of this command (point it at one of your cameras by IP, username, and password):

http://username:password@ipaddress:80/cgi-bin/deviceDiscovery.cgi?action=attach

I only have one camera so far, and when I add more they'll be through blue iris, so I don't need the app part. I tried setting up the camera device directly, and it seems to have worked - it returned the following under "Current States"

  • image : file:c4f6207d-a40f-4283-a528-caceb9d7664e
  • imageTimestamp : 1675184877050
    and
  • devInfo : {deviceType=AD410 , machineName=Doorcam , serialNo=Z170C4140E914 }
    under "State Variables".

However, I tried your username:password@ipaddress:80 URL and it just comes back with "Error" in the upper left corner. I verified that I used the same info here as I did in the device parameters, so I think either both or neither should have worked.

Yep, those values on the device page indicate that it is working.

What firmware version are you running on your AD410? @kutoroff, which cameras and firmware versions did you try it with? Seems like you all are getting the same result.

I will update the app to at least handle this as a possible error condition and provide a more descriptive error.

I've installed your image server app and made a "button" on a dashboard with the stored photo, and it's definitely working.

The firmware version reports "1.000.0000000.7.R.210220" and says it's "up to date".

1 Like

The device is working well and I deleted the camera discovery app. Its logs remain.

I'll be adding my second camera with the driver today and I have one question.
What is the minimum user capability required for the login credentials?

I'm using my admin account now, tried with a view only user login and was unable to take a snapshot in the driver. It was real early in the morning, so it might have been my error.
Still, want the login credential to to be as low as possible.

Thanks,
SK!

The API document I used did not specify account levels for the various operations, so I don't know how the specific requirements may vary by camera type.

What happened when you tried to take a snapshot with a view only account (an error in the Logs, I presume?). Do you still get events, such as motion or button press, with a read-only account? I'd like to make sure I have proper error handling for those cases and also will update my readme to specify the account type requirement.

@techbill, do you have any experience with the different account levels that are mentioned here?