1.5.1 • Published 5 years ago

homebridge-dafang v1.5.1

Weekly downloads
40
License
ISC
Repository
github
Last release
5 years ago

homebridge-dafang

NPM

npm npm CircleCI

Homebridge Plugin for Xiaomi Dafang / Wyze Camera

Installation

  1. Install ffmpeg on your device
    $ brew install ffmpeg --with-openh264 --with-fdk-aac
  1. Install the plugin using:
    $ npm install -g --unsafe-perm homebridge
    $ npm install -g --unsafe-perm homebridge-dafang
  1. Install CFW on camera and set up MQTT. Refer to Setup Readme
  2. Edit config.json and add the plugin. Refer to config-sample.json in repository.
  3. Run Homebridge
  4. Add extra camera accessories in Home app. The setup code is the same as in homebridge.You can go into -> + -> Add New Accessory -> Add Manually -> Add Homebridge Pin -> Select Camera -> Add

Supported Cameras :

NamePicture
Xiaomi DafangDafang
Xiaomi Xiaofang 1SXiaoFang
Wyzecam PanDafang
Wyzecam V2XiaoFang
Sannce I21AG, MixSight HX-I2110T2, WanScam HW0036, Escam G02, Digoo BB-M2XiaoFang
Any other Device with Ingenic T10/T20 DeviceT20

Todo :

  • Timelapse Switch
  • Intercom 2 Way Audio **

Accessories :

AccessoryTypeDescriptionConfig
Motion SensormotionSensorAlerts if Motion is Detectedthreshold(optional) => In ms.
Rich Motion SensorrichMotionSensorAlerts if Motion is Detected (Rich Notifications)threshold(optional) => In ms.
Night Vision SensornightVisionSensorAlerts if Night Mode is Detectedthreshold(optional) => In ms.
Night Vision SwitchnightVisionSwitchToggles Night Mode on Camera => IR_LED ON IR_CUT OFFNone
Brightness Lux SensorbrightnessBrightness Lux SensorNone
Automatic Night Mode Toggle SwitchautoNightVisionSwitchToggles Automatic Night Mode on CameraNone
Automatic Motion Tracking SwitchautoMotionTrackingSwitchToggles Automatic Motion Tracking on DafangNone
Move/Rotate Camera MotormoveCameraMoves Dafang Camera Horizontal/Vertical right/left up/down Motoraxis(required) => horizontal/vertical, direction(required) => left/right for horizontal and up/down for vertical
Record Video+AudiorecordVideoRecords Video + Audio Toggle Switch. Video(mp4) files are saved in local machine running homebridgeNone
Record Audio OnlyrecordAudioRecords Audio Toggle Switch. Audio(aac) files are saved in local machine running homebridgeNone
Capture ImagecaptureImageCaptures Image from Camera and saves to configured folderNone
Recorded Media Storage SensorstorageSensorAlerts when recorded media folder storage is full on the system due to recordings. You can set custom disk space in MB in configNone
Clear Storage SwitchclearStorageClears All RecordingsNone
Reset FFMEPG SwitchresetFFMPEGKills all FFMPEG Zombie Scripts. Audio/Video Recordings will restart recording.None
Motion Detection SwitchmotionDetectionEnables/Disable Motion Detection. Turning off this switch will stop sending motion detection alerts.None
RTSP Server SwitchrtspSwitchDebug Switch to turn on/off RTSP H264 Stream Server.None
MJPEG Server SwitchmjpegSwitchDebug Switch to turn on/off MJPEG ServerNone
Recalibrate Motor SwitchrecalibrateSwitchDebug Switch to Re-Calibrate Camera Motor.None
Restart Camera SwitchrestartSwitchDebug Switch to restart Camera.None
Re-Mount SD Card RW SwitchremountSwitchDebug Switch to re mount sd card with RW permission. It prevents SD Card Failures like stuck RTSP Stream.None

Threshold => Lesser Threshold, More Accuracy. Dafang Motion detection is sensitive, and it toggles very quickly, to keep the state of sensor more stable little threshold will delay frequent alerts

Demo :

Sorry for crappy quality. Tested on Rpi + Slow Network

Advanced Demo :

Advanced Demo

Simple Demo :

Simple Demo

Rich Notifications :

Plugin Config :

ConfigTypeDescriptionConfig
mqtt.hostBrokerboolSet true to host MQTT Locally, set false to connect to external MQTT Broker.Required
camerasArray (Object)Can add Multiple CamerasRequired

Camera Config :

ConfigTypeDescriptionConfig
cameraRTSPStreamUrlstringRTSP Stream Url e.g. rtsp://192.168.1.2:8554/unicastRequired
disableStreamboolSet true to stream camera, set false to disable camera viewOptional
mqttTopicstringEach Dafang Device must have a unique topic. Topic should match for each corresponding camera accessoryRequired
folderstringAbsolute path of directory where recordings/images will be savedRequired
segmentLengthnumberLength of each video file. (in seconds). Each recording will be saved in segmented videos. Default : 60 (1 minute)Optional
maxDirSizenumberMax Size of folder (in mb) where recordings will be saved. Default : 2048 (2GB)Optional
checkStorageSizeIntervalnumberTime in seconds to re check recording folder size for storageSensor. Default : 300 (5 min)Optional
recordingDirectoryPathFormatstringDateTime format for Recordings Directory Path. Default : MMM-Do-YYOptional
recordingFilenameFormatstringDateTime format for Recordings Filename. Default : YYYY-M-D-h-mm-ssOptional

Refer to https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/ for custom DirectoryPath/FileName formats for recordings..

{
    "platforms": [
        {
            "platform": "Dafang",
            "mqtt": {
                "hostBroker": true,
                "port": 1883,
                "host": "localhost",
                "debug": true,
                "mongoUrl": "mongodb://localhost:27017/mqtt"
            },
            "cameras": [{
                "cameraName": "My Dafang",
                "cameraRTSPStreamUrl": "rtsp://192.168.1.12:8554/unicast",
                "mqttTopic": "myhome/dafang/#",
                "folder": "/Users/sahilchaddha/Sahil/Recordings/",
                "accessories": [
                                    {
                                        "name": "Living Room Motion Sensor",
                                        "type": "richMotionSensor",
                                        "threshold": 300000
                                    },
                                    {
                                        "name": "Living Room Auto Motion Tracking Switch",
                                        "type": "autoMotionTrackingSwitch"
                                    },
                                    {
                                        "name": "Living Room Night Vision Sensor",
                                        "type": "nightVisionSensor",
                                        "threshold": 0
                                    },
                                    {
                                        "name": "Living Room Night Vision Switch",
                                        "type": "nightVisionSwitch"
                                    },
                                    {
                                        "name": "Living Room Auto Night Vision Switch",
                                        "type": "autoNightVisionSwitch"
                                    },
                                    {
                                        "name": "Horizontal Left",
                                        "type": "moveCamera",
                                        "axis": "horizontal",
                                        "direction": "left"
                                    },
                                    {
                                        "name": "Horizontal Right",
                                        "type": "moveCamera",
                                        "axis": "horizontal",
                                        "direction": "right"
                                    },
                                    {
                                        "name": "Vertical Up",
                                        "type": "moveCamera",
                                        "axis": "vertical",
                                        "direction": "up"
                                    },
                                    {
                                        "name": "Vertical Down",
                                        "type": "moveCamera",
                                        "axis": "vertical",
                                        "direction": "down"
                                    },
                                    {
                                        "name": "Record Video",
                                        "type": "recordVideo"
                                    },
                                    {
                                        "name": "Record Audio",
                                        "type": "recordAudio"
                                    },
                                    {
                                        "name": "Capture Image",
                                        "type": "captureImage"
                                    },
                                    {
                                        "name": "RPi Storage Sensor",
                                        "type": "storageSensor"
                                    },
                                    {
                                        "name": "Clear Storage Switch",
                                        "type": "clearStorage"
                                    },
                                    {
                                        "name": "Reset Streaming",
                                        "type": "resetFFMPEG"
                                    },
                                    {
                                        "name": "Camera Brightness",
                                        "type": "brightness"
                                    }
                    ]
            }]
        }
    ]
}

Lint

    $ npm run lint

Need Help ?

Get Slack Invite => https://slackin-znyruquwmv.now.sh/

Slack Channel => https://homebridgeteam.slack.com/messages/homebridge-dafang

Slack User => @sahilchaddha

Author

Sahil Chaddha

mail@sahilchaddha.com

1.5.1

5 years ago

1.5.0

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago