rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
383 stars 74 forks source link

Amcrest AD410 - Smart Human Detection not triggering with 0.9.44 release #243

Open ingrove opened 1 year ago

ingrove commented 1 year ago

After upgrading from 0.9.43 to 0.9.44, Smart Human Detection is no longer being triggered. It appears that Cross Region Detection is triggering instead. Running HA 2022.12.0, Supervisor 2022.11.2, Frontend 20221207.0-latest.

ryang3d commented 1 year ago

Same issue here. Downgrading to 0.9.43 helps though

Fran6u commented 1 year ago

Same issue here since the update..

chowhi123 commented 1 year ago

Same here

GaryOkie commented 1 year ago

The AD410 has never implemented SMART Motion Detection (SMD) capability. From day 1, it has issued IVS CrossRegionDetection for Human detection events. In newer Dahua cameras, these are selectable - SMD versus IVS, but not the doorbell.

Maybe Rroller's code previously tried to simplify things in the config UI with the binary sensors so that it equated SMD to CrossRegionDetection for any form of Human Detection - and this was backed out to avoid conflict with Dahua?

You can just select the "Cross Region Detection" sensor in the UI instead.

For clarification, here is a snippet of the relevant AD410 event payload when it trips for Human Detection...

event_type: dahua_event_received
data:
  camera: FrontDoorbell
  event: CrossRegionDetection
  payload:
    Code: CrossRegionDetection
    action: Start
    index: "0"
    data:
      Action: Appear
      EventID: 10059
      Name: IVS-1
        ObjectID: 3774
        ObjectType: Human

An alternative, is you can set up your automation to trigger on this specific event, as so:

  - platform: event
    event_type: dahua_event_received 
    id: Human Detected
    event_data:
      event: CrossRegionDetection
      payload:
        action: Start
        data:
          ObjectType: Human
coolhand72 commented 1 year ago

I am also having this same issue with my fleet of Amcrest Cameras. I suppose re-writing everything is an option to use Cross Region Detection instead of Smart Human Detection. But before I go to all the trouble, could I please receive clarification that this is the official fix? Or will the integration be restored to its previous functionality?

GaryOkie commented 1 year ago

My take is this was a breaking change that fixed other reported conflicts. See the notes in the most recent commit here: https://github.com/rroller/dahua/commit/c73afbf5e3623f82510b3c7a1d18750de35f7af2

I can't give you any official clarification other than what can be read here.

If you enable cross region detection sensor in the UI, isn't just changing (or adding) the associated binary sensor in your automations all the "re-writing" that needs to be done?