homebridge-dahua-alerts
                                
                                
                                
                                    homebridge-dahua-alerts copied to clipboard
                            
                            
                            
                        Routes motion alerts for Dahua and Lorex camera streams to homebridge-camera-ffmpeg
homebridge-dahua-alerts
Routes motion alerts for Dahua, Alhua, Amcrest and Lorex camera streams to homebridge-camera-ffmpeg
Like this plugin? -> Buy me a ☕coffee☕
Confirmed working with:
| Dahua DVR | Dahua/Amcrest Standalone Camera | Lorex DVR | 
|---|---|---|
| - | IP3M-943B | - | 
| - | IP5M-B1186EB | - | 
| - | DH-IPC-HDW3641TMP | - | 
| NVR4208-8P | - | - | 
| - | - | LHV1004 DHV | 
| DHI-HCVR4116HS-S3 | - | - | 
| DH-XVR5116HS-X | - | - | 
| - | DH-IPC-HDBW4631R-S | - | 
| DHI-NVR4104HS-P-4Ks2 | - | - | 
| - | - | NR818 | 
| - | N43AJ52-B | - | 
but lots of Dahua/Lorex NVRs and standalone cameras share this VideoMotion api.
Installation
- Install Homebridge using the official instructions.
 - Install 
homebridge-camera-ffmpeg - Configure your RTSP streams in 
homebridge-camera-ffmpeg- Configure 
"porthttp": 8088forHttp-based Automation](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/http.html) - Configure 
"motion": truefor the camera streams you want motion detection - Configure 
"motionTimeout": 0to disable automatically resetting the motion after 1 second default - (Optional) Configure 
"localhttp": trueto ensure HTTP automations only work from same device (for enhanced security) 
 - Configure 
 - Install 
homebridge-dahua-alerts. - Configure your NVR and camera settings.
- Ensure you have enabled 
httpsor port 443 on your device if you're gettingECONNREFUSEDin the debug logs. Not required by all. 
 - Ensure you have enabled 
 
Sample config.json
- Configuration for one NVR with multiple cameras
 
homebridge-camera-ffmpeg
{
    "name": "Camera FFmpeg",
    "porthttp": 8088,
    "localhttp": true,
    "cameras": [
        {
            "name": "Driveway",
            "motion": true,
            "motionTimeout": 0,
            "videoConfig": {
                "source": "-i rtsp://admin:<snip>@192.168.1.XX:554/cam/realmonitor?channel=1&subtype=1"
            }
        },
        {
            "name": "Porch",
            "motion": true,
            "motionTimeout": 0,
            "videoConfig": {
                "source": "-i rtsp://admin:<snip>@192.168.1.XX:554/cam/realmonitor?channel=2&subtype=1"
            }
        },
        {
            "name": "Backdoor",
            "motion": true,
            "motionTimeout": 0,
            "videoConfig": {
                "source": "-i rtsp://admin:<snip>@192.168.1.XX:554/cam/realmonitor?channel=4&subtype=1"
            }
        }
    ],
    "platform": "Camera-ffmpeg"
}
homebridge-dahua-alerts
{
    "cameras": [
        {
            "index": 0,
            "cameraName": "Driveway"
        },
        {
            "index": 1,
            "cameraName": "Porch"
        },
        {
            "index": 3,
            "cameraName": "Backdoor"
        }
    ],
    "homebridgeCameraFfmpegHttpPort": 8088,
    "host": "XX.XX.XX.XX",
    "user": "admin",
    "pass": "XX",
    "eventTypes": 
        {
        "VideoMotion": true
        },
    "platform": "dahua-alerts"
}
homebridgeCameraFfmpegHttpPortmust match theporthttpconfig in thehomebridge-camera-ffmpegconfighostis the IP of the NVR or camerauseris username of the NVR or camerapassis the password of the NVR or cameraeventTypesare a list of events you want to subscribe to. Currently the list includesVideoMotion,AlarmLocal,SmartMotionHuman,SmartMotionVehicle,CrossLineDetection, andCrossRegionDetectionuseHttp(optional) use HTTP instead of HTTPS to connect to host
For each camera you want to monitor, add a new entry to the cameras array.
indexif the camera's channel number substracted by 1 (the index starts from 0, the camera channel starts from 1)cameraNamemust match thenameof the camera specified in thehomebridge-camera-ffmpegconfig
Override Camera Connection Credentials
This is useful if you have standalone IP Camera(s) (not going through an NVR), a mix of IP Cameras and NVR(s), or multiple NVRs.
To define a host/user/pass on a camera simply add the cameraCredentials object. If you have a top level host/user/pass defined, this object will override it.
    "cameras": [
        {
            "index": 0,
            "cameraName": "Driveway"
            "cameraCredentials": {
                    "host": "XX.XX.XX.XX",
                    "user": "admin",
                    "pass": "XX"
            }
        },
- If using a standalone camera, the index will always be 
0 
Local development
npm run buildto get JS output indist
Credits
Referenced nayrnet/node-dahua-api for the Dahua/Lorex motion alerts API.