psyciknz / CameraEvents

Dahua NVR/Camera Alerting to MQTT. Fairly specific to my needs, but also an attempt at starting to use travis.
Eclipse Public License 2.0
58 stars 19 forks source link

Supporting additional audio events #16

Open kiwijunglist opened 4 years ago

kiwijunglist commented 4 years ago

Was hoping to add support for audio events for my amcrest camera

[MQTT Broker]
IP: 192.168.1.99
Port: 1883
BaseTopic = dahua

[Cameras]
camera1=babycam

[babycam]
host=192.168.1.90
protocol=http
name=babycam
port=80
isNVR=False
user=admin
pass=xxx
auth=basic
events=VideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure
amcrest01 amcrest02
2020-07-02 12:17:30,651 - __main__ - INFO - Loading config
2020-07-02 12:17:30,652 - __main__ - DEBUG - Device babycam Getting channel ids: http://192.168.1.90:80/cgi-bin/configManager.cgi?action=getConfig&name=ChannelTitle
2020-07-02 12:17:30,741 - __main__ - INFO - Created Data Device: babycam
2020-07-02 12:17:30,741 - __main__ - DEBUG - Added Dahua device at: http://192.168.1.90:80/cgi-bin/eventManager.cgi?action=attach&codes=%5BVideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure%5D
2020-07-02 12:17:30,741 - __main__ - DEBUG - Connecting to MQTT Broker
2020-07-02 12:17:30,742 - __main__ - DEBUG - Starting MQTT Loop
2020-07-02 12:17:30,742 - __main__ - INFO - Connected to MQTT OK Returned code=0
2020-07-02 12:18:20,857 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:18:20.857747
2020-07-02 12:19:10,970 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:19:10.970026

2020-07-02 12:40:27,102 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0
2020-07-02 12:40:35,270 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:78
Code=VideoMotion;action=Stop;index=0;data={
   "RegionName" : [ "Region1" ]
}
2020-07-02 12:40:35,271 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion
kiwijunglist commented 4 years ago

I can see video motion events, however I don't see any audio events.

kiwijunglist commented 4 years ago

ok really strange, it seems to be working now

2020-07-02 12:53:33,254 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly
2020-07-02 12:53:38,517 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0
2020-07-02 12:53:38,517 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation
2020-07-02 12:53:39,270 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0
psyciknz commented 4 years ago

Want to do a PR for updating the readme for the new events?

kiwijunglist commented 4 years ago

Sure i will try. I haven't done a PR before, but would be a good thing to know how to do.

kiwijunglist commented 4 years ago

ok I have no idea.

kiwijunglist commented 4 years ago

Supported Events (dependent on camera):

VideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure

kiwijunglist commented 4 years ago

Heres a paste of output from logs if needed:

2020-07-02 12:37:33,458 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:37:33.458049
2020-07-02 12:38:23,571 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:38:23.571020
2020-07-02 12:39:12,781 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:79
Code=VideoMotion;action=Start;index=0;data={
   "RegionName" : [ "Region1" ]
}
2020-07-02 12:39:12,782 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion
2020-07-02 12:39:12,782 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0
2020-07-02 12:39:13,685 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:39:13.685171
2020-07-02 12:39:19,298 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:78
Code=VideoMotion;action=Stop;index=0;data={
   "RegionName" : [ "Region1" ]
}
2020-07-02 12:39:19,298 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion
2020-07-02 12:40:03,798 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:40:03.798544
2020-07-02 12:40:27,101 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:79
Code=VideoMotion;action=Start;index=0;data={
   "RegionName" : [ "Region1" ]
}
2020-07-02 12:40:27,101 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion
2020-07-02 12:40:27,102 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0
2020-07-02 12:40:35,270 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:78
Code=VideoMotion;action=Stop;index=0;data={
   "RegionName" : [ "Region1" ]
}
2020-07-02 12:40:35,271 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion
2020-07-02 12:40:53,913 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:40:53.913384
2020-07-02 12:41:44,026 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:41:44.025993
2020-07-02 12:42:34,140 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:42:34.140036
2020-07-02 12:43:24,252 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:43:24.252199
2020-07-02 12:44:14,364 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:44:14.364669
2020-07-02 12:45:04,477 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:45:04.477122
2020-07-02 12:45:54,589 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:45:54.589424
2020-07-02 12:46:44,701 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:46:44.701590
2020-07-02 12:47:34,817 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:47:34.817204
2020-07-02 12:48:24,929 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:48:24.929667
2020-07-02 12:49:15,042 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:49:15.042411
2020-07-02 12:49:28,900 - __main__ - INFO - Loading config
2020-07-02 12:49:28,901 - __main__ - DEBUG - Device babycam Getting channel ids: http://192.168.1.90:80/cgi-bin/configManager.cgi?Action=getConfig&name=ChannelTitle
2020-07-02 12:49:28,987 - __main__ - INFO - Created Data Device: babycam
2020-07-02 12:49:28,987 - __main__ - DEBUG - Added Dahua device at: http://192.168.1.90:80/cgi-bin/eventManager.cgi?action=attach&codes=%5BVideoMotion,AudioAnomaly,AudioMutation%5D
2020-07-02 12:49:28,987 - __main__ - DEBUG - Connecting to MQTT Broker
2020-07-02 12:49:28,988 - __main__ - DEBUG - Starting MQTT Loop
2020-07-02 12:49:28,989 - __main__ - INFO - Connected to MQTT OK Returned code=0
2020-07-02 12:50:18,502 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:50:18,503 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:50:18,553 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:37
Code=AudioAnomaly;action=Stop;index=0

2020-07-02 12:50:18,553 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:50:19,256 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0

2020-07-02 12:50:19,256 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:50:39,803 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioAnomaly;action=Start;index=0

2020-07-02 12:50:39,803 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:50:42,259 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:37
Code=AudioAnomaly;action=Stop;index=0

2020-07-02 12:50:42,259 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:50:45,868 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:50:45,868 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:50:46,269 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0

2020-07-02 12:50:46,269 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:01,253 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:51:01,254 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:02,256 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0

2020-07-02 12:51:02,257 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:09,222 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:51:09.222798

2020-07-02 12:51:21,300 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioAnomaly;action=Start;index=0

2020-07-02 12:51:21,300 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:51:55,427 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:51:55,427 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:56,280 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:37
Code=AudioAnomaly;action=Stop;index=0

2020-07-02 12:51:56,280 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly

2020-07-02 12:51:56,331 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0

2020-07-02 12:51:56,331 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:51:59,338 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:51:59.338196

2020-07-02 12:52:15,174 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:52:15,174 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:52:16,277 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0

2020-07-02 12:52:16,277 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:52:33,617 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:52:33,617 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:52:34,269 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0
2020-07-02 12:52:34,270 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation
2020-07-02 12:52:48,502 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0
2020-07-02 12:52:48,502 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation
2020-07-02 12:52:49,254 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioMutation;action=Stop;index=0
2020-07-02 12:52:49,254 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation
2020-07-02 12:52:49,455 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:52:49.455499
2020-07-02 12:53:11,204 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:38
Code=AudioAnomaly;action=Start;index=0
2020-07-02 12:53:11,204 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly
2020-07-02 12:53:33,254 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:37
Code=AudioAnomaly;action=Stop;index=0
2020-07-02 12:53:33,254 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioAnomaly
2020-07-02 12:53:38,517 - __main__ - DEBUG - [babycam]: --myboundary
Content-Type: text/plain
Content-Length:39
Code=AudioMutation;action=Start;index=0

2020-07-02 12:53:38,517 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:53:39,270 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:38

Code=AudioMutation;action=Stop;index=0

2020-07-02 12:53:39,270 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:53:39,571 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:53:39.571631

2020-07-02 12:53:45,184 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:39

Code=AudioMutation;action=Start;index=0

2020-07-02 12:53:45,184 - __main__ - INFO - dahua_event_received: babycam Index: 0 Code: AudioMutation

2020-07-02 12:53:47,024 - __main__ - INFO - Loading config

2020-07-02 12:53:47,025 - __main__ - DEBUG - Device babycam Getting channel ids: http://192.168.1.90:80/cgi-bin/configManager.cgi?action=getConfig&name=ChannelTitle

2020-07-02 12:53:47,101 - __main__ - INFO - Created Data Device: babycam

2020-07-02 12:53:47,101 - __main__ - DEBUG - Added Dahua device at: http://192.168.1.90:80/cgi-bin/eventManager.cgi?action=attach&codes=%5BVideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure,Audio,AudioAlarm,AudioEvent,AudioIntensity,AudioIntensityChange,IntensityChange%5D

2020-07-02 12:53:47,102 - __main__ - DEBUG - Connecting to MQTT Broker

2020-07-02 12:53:47,103 - __main__ - DEBUG - Starting MQTT Loop

2020-07-02 12:53:47,104 - __main__ - INFO - Connected to MQTT OK Returned code=0

2020-07-02 12:54:37,218 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:54:37.218418

2020-07-02 12:54:39,374 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:79

Code=VideoMotion;action=Start;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:54:39,375 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:54:39,376 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0

2020-07-02 12:54:44,287 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:78

Code=VideoMotion;action=Stop;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:54:44,287 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:55:27,334 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:55:27.334183

2020-07-02 12:55:39,612 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:79

Code=VideoMotion;action=Start;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:55:39,612 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:55:39,613 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0

2020-07-02 12:55:51,341 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:78

Code=VideoMotion;action=Stop;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:55:51,341 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:55:52,144 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:79

Code=VideoMotion;action=Start;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:55:52,144 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:55:52,145 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0

2020-07-02 12:56:15,247 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:78

Code=VideoMotion;action=Stop;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:56:15,247 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:56:16,550 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:79

Code=VideoMotion;action=Start;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:56:16,550 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:56:16,551 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0

2020-07-02 12:56:17,456 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:56:17.456010

2020-07-02 12:56:23,269 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:78

Code=VideoMotion;action=Stop;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:56:23,269 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:56:24,974 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:79

Code=VideoMotion;action=Start;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:56:24,974 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:56:24,975 - __main__ - INFO - Snapshot Url: http://192.168.1.90:80/cgi-bin/snapshot.cgi?channel=0

2020-07-02 12:56:48,630 - __main__ - DEBUG - [babycam]: --myboundary

Content-Type: text/plain

Content-Length:78

Code=VideoMotion;action=Stop;index=0;data={

   "RegionName" : [ "Region1" ]

}

2020-07-02 12:56:48,630 - __main__ - INFO - Video Motion received: babycam Index: 0 Code: VideoMotion

2020-07-02 12:57:07,573 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:57:07.573239

2020-07-02 12:57:57,687 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:57:57.687337

2020-07-02 12:58:47,799 - __main__ - DEBUG - Heartbeat: 2020-07-02 12:58:47.799403

2020-07-02 12:59:37,911 - __main__ - DEBUG - Heartbeat: 2020-0
kiwijunglist commented 4 years ago

I'm not actually a coder I'm in the medical profession.

Also i thought the PR was just updating the wiki as I assumed the script just posted any event to mqtt, I see it doesn't publish the audio events to mqtt unfortunately.

kiwijunglist commented 4 years ago

Added help request here:

https://ipcamtalk.com/threads/cameraevents-service-dahua-events-to-mqtt.36678/post-462819

psyciknz commented 4 years ago

Did you get it working? I thought I saw you did?

In the config for the events can you add your AudioMutation or the other one? And do they get picked up?

psyciknz commented 4 years ago

Ok. I’ll have a look tomorrow.

Yeah so or would be you’d fork (take a copy of the repository) and edit the README.md. Save and commit to git.

Then do a new pull request and I can review it then accept it (or not)

But if it needs more that just an update to the read me I can try and look at it.

kiwijunglist commented 4 years ago

I can see the events in the log file, however nothing is published to the mqtt broker.

I can only see VideoMotion events in the mqtt broker.

It needs more than just an update to the readme file.

Thanks Mike

psyciknz commented 4 years ago

I do have this catch all

LOGGER.info("dahua_event_received: "+ Alarm["name"] + " Index: " + Alarm["channel"] + " Code: " + Alarm["Code"]) self.client.publish(self.basetopic +"/" + Alarm["channel"] + "/" + Alarm["name"],Alarm["Code"])

If you subscribe to cameraevents/#. You see nothing? It won’t have an image.

Video motion triggers an image, and some of the Ivs items. Everything else it picks up it doesn’t know what to do with is supposed to trigger this section.

kiwijunglist commented 4 years ago

MQTT Output:

amcrest03

config.ini

[MQTT Broker]
IP: 192.168.1.99
Port: 1883
BaseTopic = dahua

[Cameras]
camera1=babycam

[babycam]
host=192.168.1.90
protocol=http
name=babycam
port=80
isNVR=False
user=admin
pass=xxx
auth=basic
events=VideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure,Audio,AudioAlarm,AudioEvent,AudioIntensity,AudioIntensityChange,IntensityChange

docker-compose

  dahua_camera_events:
    container_name: dahua_camera_events
    image: psyciknz/cameraevents
    restart: always
    environment:
      - PGID=${PGID}
      - PUID=${PUID}
      - TZ=${TZ}
    volumes:
      - ${DOCKERCONFDIR}/dahua_camera_events/config.ini:/opt/cameraevents/conf/config.ini   
kiwijunglist commented 4 years ago

I only have

dahua/$online dahua/$heartbeat dahua/VideoMotion/0

kiwijunglist commented 4 years ago

sorry it's working now.

I changed the config.ini to

events=VideoMotion,AudioAnomaly,AudioMutation

Instead of

events=VideoMotion,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction,VideoBlind,AudioAnomaly,AudioMutation,VideoAbnormalDetection,SceneChange,LoginFailure,Audio,AudioAlarm,AudioEvent,AudioIntensity,AudioIntensityChange,IntensityChange

I think the invalid events stopped it working properly.

kiwijunglist commented 4 years ago

I think these were invalid events that I added at the end when testing.

Audio,AudioAlarm,AudioEvent,AudioIntensity,AudioIntensityChange,IntensityChange