Hello! I recently purchased my first IP camera (Dahua N43AJ52) and have started working on integrating it into my existing home automation setup. I've been successful at getting the camera working in Apple HomeKit through Homebridge, notably with support for Dahua's smart motion detection (SMD) feature that allows motion detection to be filtered on the camera to just trigger on people and/or vehicles. I now get push notifications on my Apple devices, complete with a snapshot image, whenever a person or vehicle moves on my driveway.
Here's how I accomplished that, in case it helps others:
1. Set up a Homebridge server (I'm using a Raspberry Pi running their slick official image)
2. Install the homebridge-camera-ffmpeg plugin, configuring it with your camera(s) and localhttp enabled (see below for my config for pointers)
3. Install the homebridge-dahua-alerts plugin, also configuring it with your camera info
4. Modify the dahua plugin's JavaScript to have it listen for smart motion events instead of the normal ones. This is done by editing /usr/local/lib/node_modules/homebridge-dahua-alerts/dist/dahua.js (if you're using Linux), replacing the text "codes=[VideoMotion]" with "codes=[SmartMotionHuman%2CSmartMotionVehicle]" (I've filed a feature request with the author to incorporate that functionality into the plugin)
That should be it! End result should be the camera snapshot showing in your Home app, with a live feed showing when you tap it, that also sends you push notifications upon smart motion alerts. If you don't get alerts and have confirmed everything's set up right in your config, verify that you've enabled SMD on your camera(s) as well.
My (censored) Homebridge config:
Here's how I accomplished that, in case it helps others:
1. Set up a Homebridge server (I'm using a Raspberry Pi running their slick official image)
2. Install the homebridge-camera-ffmpeg plugin, configuring it with your camera(s) and localhttp enabled (see below for my config for pointers)
3. Install the homebridge-dahua-alerts plugin, also configuring it with your camera info
4. Modify the dahua plugin's JavaScript to have it listen for smart motion events instead of the normal ones. This is done by editing /usr/local/lib/node_modules/homebridge-dahua-alerts/dist/dahua.js (if you're using Linux), replacing the text "codes=[VideoMotion]" with "codes=[SmartMotionHuman%2CSmartMotionVehicle]" (I've filed a feature request with the author to incorporate that functionality into the plugin)
That should be it! End result should be the camera snapshot showing in your Home app, with a live feed showing when you tap it, that also sends you push notifications upon smart motion alerts. If you don't get alerts and have confirmed everything's set up right in your config, verify that you've enabled SMD on your camera(s) as well.
My (censored) Homebridge config:
JavaScript:
{
"platforms": [
{
"name": "Camera FFmpeg",
"porthttp": 8088,
"localhttp": true,
"cameras": [
{
"name": "Driveway",
"manufacturer": "Dahua",
"model": "N43AJ52",
"motion": true,
"motionTimeout": 0,
"unbridge": true,
"videoConfig": {
"source": "-rtsp_transport tcp -i rtsp:/192.168.0.123:554/cam/realmonitor?channel=1&subtype=2&unicast=true&proto=Onvif",
"stillImageSource": "-i http://user:pass@192.168.0.123/cgi-bin/snapshot.cgi?1",
"maxWidth": 0,
"maxHeight": 0,
"maxFPS": 0,
"maxBitrate": 3000,
"forceMax": true,
"vcodec": "copy",
"packetSize": 1316,
"audio": true,
"debug": false
}
}
],
"platform": "Camera-ffmpeg"
},
{
"homebridgeCameraFfmpegHttpPort": 8088,
"cameras": [
{
"index": 0,
"cameraName": "Driveway",
"cameraCredentials": {
"host": "192.168.0.123",
"user": "admin",
"pass": "admin"
}
}
],
"platform": "dahua-alerts"
}
]
}