Dahua and Amcrest integration for cameras and doorbells

Please PM me the output of this URL from a PC on the same subnet as your Hubitat hub (replace each of the values with your actual values for username, etc).

http://username:password@ipAddress:port/cgi-bin/deviceDiscovery.cgi?action=attach

Just making sure you saw this @CAL.hub

I'm in to test this out. I have a lot of Dahua cams around the house. I have setup 1 as a test. Take works and I see the photo in the driver. Is there anyway to use that? Dashboard?

I described the steps a bit earlier in this thread. Please give this a try: Dahua and Amcrest integration for cameras and doorbells - #4 by tomw

Do you see good results with real-time events (motion, doorbell press if you're using that, object detection, etc)?

Thanks just found that and working through the app install.

I do not use doorbell cams. But I do have motion events for all my cams. Literally installed this 10 minutes ago as I found the link on ipcamtalk.

Cool! Let me know if you run into any issues or have questions. I'm still fine tuning this as it gets more runtime on a variety of systems.

This might be cool to combine with the virtual blueiris camera stream object. It would cover all bases!

1 Like

Seeing a lot of this:

Those timeouts are expected if there are no events. Can you trigger a motion event and see if it comes through?

FYI, I am working on an updated version that does a sort of heartbeat to keep the timeouts to a minimum to avoid any side effects to the hub. I expect to post that soon once I can get some beta test coverage.

manually triggered motion event and I don't see anything new in the driver indicating motion
EDIT: Scratch that...I triggered motion in BlueIris...duh...let me trigger the cam

1 Like

image

Nice! If you look at the device page, there are attributes that are populated. For example, crossLineDetected.

Look at the events history, and you should see "Rule1" when it became active and "waiting" when it became inactive again. You could use events on those attributes as triggers for your automations.

Yep those are there

1 Like

I just pushed v0.9.1 to GitHub and HPM, which has some improvements for connection reliability.

Only the "cameraDriver" file was updated. After you update the driver code, hit Initialize on your camera devices or just reboot Hubitat.

You will see some additional debug prints that include the term "heartbeat". I am still fine-tuning for performance, and there are some differences across the different camera systems that I have seen so far. I welcome any feedback or issues via PM (with verbose debug prints!).

1 Like

I will check it out when I get a chance to. Been really busy this week with work.

1 Like

Thanks again for working through these issues. It appears these last changes have had a positive effect on the issue I was seeing with free memory as well. Here's the stats on my hub after 14 hours of uptime.

Screen Shot 2023-01-07 at 8.10.54 AM

3 Likes

Here is an important update for anyone that uses the Image Server app. A new version will be required for compatibility with my next driver update.

Please have a look and update if you are using the take command with your virtual devices from my Dahua integration.

1 Like

Thank you creating this driver, and the Image Server app.

I am using:
Dahua camera discovery v0.9.1 (app)
Dahua/Amcrest Camera v0.9.1 (driver)
Image Server v0.9.0 (app)

I have the logical device working for an Amcrest IP3M-943W. (This model was discontinued ~3 years ago and firmware was not updated to what is currently on Amcrest cameras – just an fyi.) The camera’s image is displayed on the logical device page.

  1. The Image Server app displays the generated URL. I created a Dashboard tile with the URL and receive log warnings from the Dashboard app:
    app:392023-01-19 08:45:46.764 AMwarnExcluded attribute displayImage size of attribute > 1024 characters
    app:392023-01-19 08:45:46.755 AMwarnExcluded attribute image size of attribute > 1024 characters

When I paste the URL into Firefox, I receive “pastedURL cannot be displayed as it contains errors.” I’m assuming I should be able to view the image in a browser.

  1. The heartbeat is every 30 seconds. Will this be configurable in the future?

  2. Is username/password sent to the camera in cleartext?

1 Like

Sorry for the trouble; I introduced a bug with some last-minute cleanup. (Congratulations, you were evidently the first user of the new code :wink: ).

I checked in a fix, so please 'repair' in HPM or just grab the code again from GitHub if you installed manually. This only affected the Image Server app code.

Actually, that part of the code is going away all together. I worked out a better scheme for maintaining the connection.

Just to be clear, this is just about keeping the EventStream active, which is necessary because if it is dropping all the time you may miss events, and we also noticed that the Hubitat performance could be affected if the connection was closed and reopened repeatedly over time. The "heartbeat" behavior is not something that should be user-visible or particularly useful in general.

Is there something you were hoping to utilize it for, or could you explain more about why you wanted it to be configurable?

It is possible that the password is sent in cleartext at least once when connecting, as well as during the discovery process if you use the app. Is there an HTTPS option for your cameras? I could make that a configurable option.

Fixed. Thank you. (For testers, viewing in a browser is simply a check that the image file is accessible.)

If the heartbeat were configurable, it could be increased (more time between beats) to lessen the load on the hub. Currently I am not using motion settings on the camera, so the heartbeat could be burdensome. My plan was to create a rule and update the image periodically. If the heartbeat is removed then this issue is irrelevant.

I am unsure if there is an HTTPS option on my current camera, but at some point I will be upgrading. (My camera’s firmware requires a plugin (Amcrest/Dahua’s webplugin.exe) to view the live feed via a browser. Only Internet Explorer supports the plugin.) I assume a currently produced camera has an HTTPS option, so the option would be valuable.

1 Like