I hade same problem because new firmware use channel 1 instead of 0.
If you choose resolution: low it will use channel 1 instead of channel 0.
###############################
amcrest:
the comments in snapshot.py are (and have been) misleading regarding the channel parameter. It actually selects from the video streams. 0 is the Main Stream, and 1 is the Sub Stream. In HA it is controlled by the resolution configuration variable. The value of high corresponds to channel 0, and the value of low corresponds to channel 1. So, if you need channel 1, then you should set resolution to low in your amcrest configuration. https://github.com/home-assistant/home-assistant/pull/22949#issuecomment-485488616
Regarding the channel parameter of the snapshot command, it does indeed select the video channel number. It is supposed to start from 1, but it seems in some (maybe older???) firmware versions channel 0 seems to be equivalent to 1. It does not select between the main and extra streams. And, yes, the comments in snapshot.py are misleading. I have it on my list of changes to make to fix that.
But more important than the comments are what the code currently does, both in the amcrest package and in the HA amcrest component. Currently the resolution setting is used to send a 0 or a 1 as the channel number. But what I believe it should do is to not send the channel parameter at all (so that the camera firmware can default to the correct channel number.) Therefore, what I plan to do is to change the snapshot command in the amcrest package, and the async_camera_image method in the HA amcrest component, so that the snapshot command is sent without the ?channel=N parameter. Could you check for me, if you use http://IP:PORT/cgi-bin/snapshot.cgi in a browser, does it work? It works for me with my Amcrest cameras.
From the Amcrest HTTP Protocol API Specifications:
Specifically post #228 and #231.
Video from post #228
Are you trying to do something like that using HA? That is what I want to do. Use IVS to trigger event in HA and use on board speaker through camera to play an mp3 after each tripwire event. Still investigating how this can be accomplished. Go3team does it with openhab which I looked into but its support for my devices was limited at best, where HA has everything up and running in a day except for my dahua camera and my onvif cameras. I see that you have been trying to find support for the dahua integration, and have tried a number of them (amazing there are so many to pick from). But which have you found supports the most features for your ZE model? I’m assuming you have the z5e or the z12e, or is there a plain ze model? In either case I think whatever you settled on should work the same for me, so i would be glad to hear your take.
I have been trying to get my still images to show on the lovalace interface but its not working like it does through the a browser. Any idea what i’m missing there?
I’ve just been using the Amcrest component. It captures the tripwire easy enough, then I do automation in Node-Red. There is a Dahua pallet in Node-Red but when I tested it my automation stopped working after a short time - seems like it stopped communicating with the camera.
HA does have a bit of delay compared to the Node-Red pallet, but it has been much more reliable.
As far as sending sound files back, I don’t think the integration has anything for it (but would have to check to be sure). If you look up the docs for it though, you might be able to find a URL to post to that could do it.
Quick google uncovered this:
Post #3 has a link to Dahua HTTP API.
Reading down through it I found this on page 94:
Hi @DeadEnd - I too am using the Amcrest component for Dahua cameras. Regarding your comment that “HA has a bit of a delay” - is that is in reference to motion detection events? If so, you should see an improvement in the latest 108.x version. @pnbruckner has updated the Amcrest integration to subscribe to events versus the previous polling method. This is indeed more responsive!
Now as far as playing audio via Amcrest component or any camera via HA streaming, that is not supported by the stream component, as verified in this post.
At the bottom of this post there was a nicely detailed solution using the ffmpeg_noise binary sensor platform.
This was done in openhab but I am trying to get it working with HA. It seems everything is there to do it. The guy that did this is go3team over on ipcam talk and hes also on reddit. Anyway he uses a z series dahua camera, I have the z12e and I think you said in another topic you have the ze model. Anyway is this your goal using tripwire to trigger a sound played over a speaker?
Love to work with you on this as I have the same goal.
No, my goal does not include playing any sounds.
I did respond to your almost exact question 3 posts up… did you not see my response?
It has some details that might help you accomplish this.
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).
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?)
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 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.
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
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:
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…
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.