rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
382 stars 73 forks source link

no SMD or IVS human/vehicle detections #288

Open n0way0ut opened 1 year ago

n0way0ut commented 1 year ago

hello,

I installed the integraion on HA and tried to check the events received with dahua_event_received, but I see only CrossRegionDetection events, nothing about vehicle or human, they are enabled because with the dahua application DMSS I receive the alerts. What may I check? thanks

n0way0ut commented 1 year ago

ok, I get these:

event_type: dahua_event_received
data:
  Code: CrossRegionDetection
  action: Start
  index: "5"
  data:
    Action: Appear
    Class: Normal
    CountInGroup: 1
    DetectRegion:
      - - 55
        - 97
      - - 8082
        - 97
      - - 8136
        - 8191
      - - 0
    - 8118
      - - 55
        - 97
    EventID: 15171
    GroupID: 5170
    LocaleTime: "2023-06-26 21:22:01"
    Name: Regola2
    Object:
      Action: Appear
      BelongID: 0
      BoundingBox:
        - 2888
        - 4320
        - 3224
        - 5632
      Center:
        - 3056
        - 4976
      Confidence: 0
      LowerBodyColor:
        - 0
        - 0
        - 0
        - 0
      MainColor:
        - 0
        - 0
        - 0
        - 0
      ObjectID: 77171
      ObjectType: Human
      RelativeID: 0
      Speed: 0
    PTS: 43842500450
    RuleID: 4
    Track: []
    UTC: 1687814520
    UTCMS: 945
  name: Garage
  DeviceName: Garage
origin: LOCAL
time_fired: "2023-06-26T20:22:00.362846+00:00"
context:
  id: XXXXXXXXXXX
  parent_id: null
  user_id: null

and

event_type: dahua_event_received
data:
  Code: CrossRegionDetection
  action: Start
  index: "3"
  data:
    Action: Appear
    Class: Normal
    CountInGroup: 1
    DetectRegion:
      - - 18
        - 73
      - - 8155
        - 49
      - - 8155
        - 8167
      - - 18
        - 8142
      - - 55
        - 73
    EventID: 13003
    GroupID: 3002
    LocaleTime: "2023-06-26 21:22:00"
    Name: Regola2
    Object:
      Action: Appear
      Attachment: []
      BelongID: 0
      BoundingBox:
        - 3824
        - 808
        - 4704
        - 2456
      BrandYear: 0
      CarLogoIndex: 0
      CarWindow:
        BoundingBox:
          - 0
          - 0
          - 0
          - 0
      Category: Unknown
      CategoryConfidence: 0
      Center:
        - 4264
        - 1632
      Confidence: 0
      FusionInfo:
        BelongID: 0
        CartPosX: 0
        CartPosY: 0
        GpsPosValid: 0
        Latitude: 0
          Longitude: 0
        ObjectSource: 0
        RadarCoorXyValid: 0
        Speed: 0
        SpeedValid: 0
        SpeedX: 0
        SpeedY: 0
      MainColor:
        - 0
        - 0
        - 0
        - 0
      ObjectID: 4290
      ObjectType: Vehicle
      PTZ:
        - 0
        - 0
        - 0
      RelativeID: 0
      Speed: 0
      SubBrand: 0
      Text: Unknown
      VehiclePosture: 1
      VehicleSignConfidence: 0
      carLenMode: 0
      carLength: 0
      carTripLineDirection: 0
    PTS: 44324508100
    RealUTC: 1687810919
    RuleID: 10
    Track: []
    UTC: 1687814519
    UTCMS: 631
  name: Gabry
  DeviceName: Gabry
origin: LOCAL
time_fired: "2023-06-26T20:22:00.296878+00:00"
context:
  id: XXXXXXX
  parent_id: null
  user_id: null

as you can see there is the ObjectType that differentiate vehicle and human, but this is esposed in the same binary_sensor on HA, is there a way to have separate sensor for human and vehicle?

jgverweij commented 1 year ago

ok, I get these:

as you can see there is the ObjectType that differentiate vehicle and human, but this is esposed in the same binary_sensor on HA, is there a way to have separate sensor for human and vehicle?

You can make use of event triggers in an automation, or set up trigger-based sensors yourself:


trigger:
  - platform: event
    event_type: dahua_event_received
    event_data:
      name: Dahua
      Code: CrossLineDetection
      action: Start
    id: general
  - platform: event
    event_type: dahua_event_received
    event_data:
      name: Dahua
      Code: CrossLineDetection
      action: Start
      data:
        Object:
          ObjectType: Human
    id: Human Motion
  - platform: event
    event_type: dahua_event_received
    event_data:
      name: Dahua
      Code: CrossLineDetection
      action: Start
      data:
        Object:
          ObjectType: Vehicle
    id: Vehicle Motion

Inspect the trace for your specific event_data