Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Human and Motion Alerts are not working #258

Open
elnorte13524 opened this issue Feb 6, 2023 · 13 comments
Open

Human and Motion Alerts are not working #258

elnorte13524 opened this issue Feb 6, 2023 · 13 comments

Comments

@elnorte13524
Copy link

elnorte13524 commented Feb 6, 2023

I am using an Amcredt AD410 with the Dahua integration.

Home Assistant 2023.1.7
Supervisor 2023.01.1
OS 9.5
Running as a VM on esxi, if that matters.

Starting on feb 1, i am no longer getting motion events from my camera. My human detection broke before that, but i cant confirm the date in my HA logs. I went back to January 15th and have no Human Detected events since then. Everything works fine in the Amcrest app. I even turned on notifications again to make sure and ive gotten multiple human and motion notifications from the Amcrest app today.
The camera works in HA, though. I see live video and that works fine.

I tried to delete the integration and reinstall it, but that didnt fix any of the detection issues and actually broke the camera feed. I restored from a backup i took overnight and the camera came back, but no detection events.

Edited to add - i also tried listening for dahua_event_received events, but as i saw activity and received notifications in the Amcrest app, i saw no events come across on the HA side.

@pspeirs
Copy link

pspeirs commented Feb 24, 2023

Try checking whether the IP address has changed, do you have it static via mac address? Each time mine has failed, I've deleted and re-added it back in. I don't know if there is a way to get the IP address of the unit via the dahua plugin or out of config but it would be helpful to be able to change it on the fly.

@elnorte13524
Copy link
Author

IP has not changed. It has a dhcp reservation in my firewall. Motion alerts still come through to home assistant and I can still stream video in home assistant, its just the person detection that isn't working in HA, but they still work in the amcrest app.

@Tunatron
Copy link

Tunatron commented Feb 24, 2023

I've noticed the same issue with my doorbell events. Literally every other part of the integration continues to work fine, just human detection has stopped triggering.

@Infeconex
Copy link

Infeconex commented Mar 8, 2023

Same issue here. Human alerts is particularly key for me. The integration is working fine, including basic motion detection. Just not the binary sensors for human and vehicle detection.

Home Assistant 2023.3.1
Supervisor 2023.03.1
Operating System 9.5
Frontend 20230302.0 - latest

Running from ODroid N2

@GaryOkie
Copy link

GaryOkie commented Mar 8, 2023

For anyone reporting AD410 Human/Motion/Button detection not working and not seeing any "dahua_event_received" events - did you update your firmware recently?

The newest version (20221201) that is only available from the Amcrest download site has broken event handling. If you installed this, go back to that site and install the previous version (20210220).

@drjjr2
Copy link

drjjr2 commented May 5, 2023

Door Bell Motion Alarm and Cross Region Detection seem to fire properly. Smart Motion Human never fires but I can set up a trigger on dahua_event_received with

Action: Start
Code: CrossRegionDetection
Data:
  Action: Appear
  Object:
    ObjectType: Human

And get a trigger for a person.
I am on firmware 20230221.
Is there something I don't have configured properly?

@Bubbgump209
Copy link

Bubbgump209 commented May 9, 2023

I think this is a duplicate of my issue #276. Something must not be parsed correctly as the camera is certainly sending the event.

Code=SmartMotionHuman;action=Start;index=0;data={
   "RegionName" : [ "Region1" ],
   "WindowId" : [ 0 ],
   "object" : [
      {
         "HumamID" : 52599,
         "Rect" : [ 2304, 736, 2752, 2944 ]
      }
   ]
}

Code=SmartMotionHuman;action=Stop;index=0;data={
   "RegionName" : [ "Region1" ],
   "WindowId" : [ 0 ],
   "object" : [
      {
         "HumamID" : 52599,
         "Rect" : [ 2400, 64, 2848, 1792 ]
      }
   ]
}

CrossLine is making to HA just fine though:


Code=CrossLineDetection;action=Start;index=0;data={
   "Class" : "Normal",
   "CountInGroup" : 1,
   "DetectLine" : [
      [ 1238, 3506 ],
      [ 3968, 3248 ]
   ],
   "Direction" : "LeftToRight",
   "EventID" : 10001,
   "GroupID" : 0,
   "Name" : "IVS-1",
   "Object" : {
      "Action" : "Appear",
      "BelongID" : 0,
      "BoundingBox" : [ 2456, 2464, 3176, 5408 ],
      "Center" : [ 2816, 3936 ],
      "Confidence" : 0,
      "LowerBodyColor" : [ 0, 0, 0, 0 ],
      "MainColor" : [ 0, 0, 0, 0 ],
      "ObjectID" : 52636,
      "ObjectType" : "Human",
      "RelativeID" : 0,
      "Speed" : 0
   },
   "PTS" : 44847664150.0,
   "RuleID" : 1,
   "Track" : [],
   "UTC" : 1683633895,
   "UTCMS" : 644
}

I'm on Dahua 2.80xxxx something.

Looking in https://github.com/rroller/dahua/blob/main/custom_components/dahua/__init__.py on lines ~485 I suspect something is getting clobbered.

@stefanoferrario
Copy link

@rroller any solution for this?

@rroller
Copy link
Owner

rroller commented Jun 15, 2023

Sorry. Short on time. I'll try looking soon.

@thedeadliestcatch
Copy link

I'm seeing something similar to this. I configure the event trigger with the right data like so:

data:
  Code: CrossRegionDetection
  action: Start
  data:
    Action: Appear
    Name: TheNameOfTheIVS

But the automation triggers for other events, Name is disregarded.

I will check the code, in case the matching is not done properly. It is relatively tricky to match arbitrary YAML against a (likely) arbitrary event payload. Not sure what approach would work best, except perhaps verifying linearly that each key-value matches the input YAML (respecting depth).

@muzzbuzz
Copy link

So, I may have found a workaround for some people out there. My issue was that I was only receiving 'VideoMotion' events and not 'SmartMotionHuman' or 'SmartMotionVehicle'.

I presume that the 'attachcode' for 'SmartMotionHuman' may not actually be called this when attempting to subscribe to it. Instead of specifying individual names for the events to subscribe to, I changed this to 'All' and now I seem to be receiving the events correctly.

Code location to change:
https://github.com/rroller/dahua/blob/321a576e5fee81de122c440ad28d806b519e35cc/custom_components/dahua/client.py#L685

See the change below:

Original:
url = "{0}/cgi-bin/eventManager.cgi?action=attach&codes=[{1}]&heartbeat=5".format(self._base, codes)
Modified:
url = "{0}/cgi-bin/eventManager.cgi?action=attach&codes=[All]&heartbeat=5".format(self._base, codes)

A full restart of HA was required as well, otherwise the .py files weren't reloaded correctly. Hopefully this helps some others and could potentially be added as an 'All' option in the UI when configuring a device.

@thedeadliestcatch
Copy link

I'm seeing something similar to this. I configure the event trigger with the right data like so:

data:
  Code: CrossRegionDetection
  action: Start
  data:
    Action: Appear
    Name: TheNameOfTheIVS

But the automation triggers for other events, Name is disregarded.

I will check the code, in case the matching is not done properly. It is relatively tricky to match arbitrary YAML against a (likely) arbitrary event payload. Not sure what approach would work best, except perhaps verifying linearly that each key-value matches the input YAML (respecting depth).

@rroller Any idea on the filtering for specific events? And how to use the event data in a message? (ex. include specific attributes or elements from it)

@thedeadliestcatch
Copy link

Still hitting this issue and it makes it impossible to filter high traffic VideoMotion events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests