{"id":13534676,"url":"https://github.com/sahilchaddha/homebridge-dafang","last_synced_at":"2025-04-07T12:02:53.122Z","repository":{"id":32906705,"uuid":"145704245","full_name":"sahilchaddha/homebridge-dafang","owner":"sahilchaddha","description":"Homebridge Plugin for Xiaomi Dafang / Wyze Cam IP Camera =\u003e Hey Siri, Start Video Recording","archived":false,"fork":false,"pushed_at":"2022-12-07T23:30:55.000Z","size":94082,"stargazers_count":206,"open_issues_count":51,"forks_count":32,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-31T11:01:41.121Z","etag":null,"topics":["dafang","ffmpeg","homebridge","homebridge-camera","homebridge-mqtt","homebridge-plugin","homekit","homekit-integration","ios","iot","iot-platform","ip-camera","mqtt","siri","wyze","wyze-cam","wyzecam","xiaomi","xiaomi-dafang","xiaomi-smart-home"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sahilchaddha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-22T12:11:26.000Z","updated_at":"2025-03-25T21:34:45.000Z","dependencies_parsed_at":"2023-01-14T22:45:27.104Z","dependency_job_id":null,"html_url":"https://github.com/sahilchaddha/homebridge-dafang","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilchaddha%2Fhomebridge-dafang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilchaddha%2Fhomebridge-dafang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilchaddha%2Fhomebridge-dafang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilchaddha%2Fhomebridge-dafang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sahilchaddha","download_url":"https://codeload.github.com/sahilchaddha/homebridge-dafang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648874,"owners_count":20972944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dafang","ffmpeg","homebridge","homebridge-camera","homebridge-mqtt","homebridge-plugin","homekit","homekit-integration","ios","iot","iot-platform","ip-camera","mqtt","siri","wyze","wyze-cam","wyzecam","xiaomi","xiaomi-dafang","xiaomi-smart-home"],"created_at":"2024-08-01T08:00:34.974Z","updated_at":"2025-04-07T12:02:53.087Z","avatar_url":"https://github.com/sahilchaddha.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# homebridge-dafang\n\n[![NPM](https://nodei.co/npm/homebridge-dafang.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/homebridge-dafang/)\n\n[![npm](https://img.shields.io/npm/dm/homebridge-dafang.svg)](https://www.npmjs.com/package/homebridge-dafang)\n[![npm](https://img.shields.io/npm/v/homebridge-dafang.svg)](https://www.npmjs.com/package/homebridge-dafang)\n[![CircleCI](https://circleci.com/gh/sahilchaddha/homebridge-dafang.svg?style=svg)](https://circleci.com/gh/sahilchaddha/homebridge-dafang)\n\n\nHomebridge Plugin for Xiaomi Dafang / Wyze Camera\n\n## Installation\n\n1. Install ffmpeg on your device\n\n```\n    $ brew install ffmpeg --with-openh264 --with-fdk-aac\n```\n\n2. Install the plugin using:\n\n```shell\n    $ npm install -g --unsafe-perm homebridge\n    $ npm install -g --unsafe-perm homebridge-dafang\n```\n\n3. Install CFW on camera and set up MQTT. Refer to [Setup Readme](https://github.com/sahilchaddha/homebridge-dafang/blob/master/Setup_MQTT.md)\n4. Edit config.json and add the plugin. Refer to `config-sample.json` in repository.\n5. Run Homebridge\n6. Add extra camera accessories in Home app. The setup code is the same as in homebridge.You can go into -\u003e ` + -\u003e Add New Accessory -\u003e Add Manually -\u003e Add Homebridge Pin -\u003e Select Camera -\u003e Add`\n\n\nSupported Cameras :\n\nName | Picture\n--- | ---\nXiaomi Dafang | ![Dafang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/dafang.png)\nXiaomi Xiaofang 1S | ![XiaoFang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/xiaofang.png)\nWyzecam Pan | ![Dafang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/dafang.png)\nWyzecam V2 | ![XiaoFang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/xiaofang.png)\nSannce I21AG, MixSight HX-I2110T2, WanScam HW0036, Escam G02, Digoo BB-M2 | ![XiaoFang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/sannce.jpg)\nAny other Device with Ingenic T10/T20 Device | ![T20](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/t20.png)\n\n## Todo : \n\n- [ ] Timelapse Switch\n- [ ] Intercom 2 Way Audio **\n\n## Accessories : \n\n| Accessory                          | Type                | Description                                           | Config |\n|------------------------------------|---------------------|-------------------------------------------------------|--------|\n| Motion Sensor                      | `motionSensor`      | Alerts if Motion is Detected                          | `threshold(optional) =\u003e In ms.`|\n| Rich Motion Sensor                      | `richMotionSensor`      | Alerts if Motion is Detected (Rich Notifications)                          | `threshold(optional) =\u003e In ms.`|\n| Night Vision Sensor                | `nightVisionSensor` | Alerts if Night Mode is Detected                      | `threshold(optional) =\u003e In ms.`|\n| Night Vision Switch                | `nightVisionSwitch` | Toggles Night Mode on Camera =\u003e IR_LED ON IR_CUT OFF  | None   |\n| Brightness Lux Sensor                | `brightness` | Brightness Lux Sensor  | None   |\n| Automatic Night Mode Toggle Switch | `autoNightVisionSwitch` | Toggles Automatic Night Mode on Camera | None     |\n| Automatic Motion Tracking Switch   | `autoMotionTrackingSwitch` | Toggles Automatic Motion Tracking on Dafang    | None  |\n| Move/Rotate Camera Motor           | `moveCamera`              | Moves Dafang Camera Horizontal/Vertical right/left up/down Motor| `axis(required) =\u003e horizontal/vertical, direction(required) =\u003e left/right for horizontal and up/down for vertical`|\n| Record Video+Audio           | `recordVideo`              | Records Video + Audio Toggle Switch. Video(mp4) files are saved in local machine running homebridge| None|\n| Record Audio Only           | `recordAudio`              | Records Audio Toggle Switch. Audio(aac) files are saved in local machine running homebridge| None|\n| Capture Image           | `captureImage`              | Captures Image from Camera and saves to configured folder| None|\n| Recorded Media Storage Sensor           | `storageSensor`              | Alerts when recorded media folder storage is full on the system due to recordings. You can set custom disk space in MB in config| None|\n| Clear Storage Switch           | `clearStorage`              | Clears All Recordings| None|\n| Reset FFMEPG Switch           | `resetFFMPEG`              | Kills all FFMPEG Zombie Scripts. Audio/Video Recordings will restart recording.| None|\n| Motion Detection Switch           | `motionDetection`              | Enables/Disable Motion Detection. Turning off this switch will stop sending motion detection alerts.| None|\n| RTSP Server Switch           | `rtspSwitch`              | Debug Switch to turn on/off RTSP H264 Stream Server.| None|\n| MJPEG Server Switch           | `mjpegSwitch`              | Debug Switch to turn on/off MJPEG Server| None|\n| Recalibrate Motor Switch           | `recalibrateSwitch`              | Debug Switch to Re-Calibrate Camera Motor.| None|\n| Restart Camera Switch           | `restartSwitch`              | Debug Switch to restart Camera.| None|\n| Re-Mount SD Card RW Switch           | `remountSwitch`              | Debug Switch to re mount sd card with RW permission. It prevents SD Card Failures like stuck RTSP Stream.| None|\n\nThreshold =\u003e 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\n\n ## Demo :\n\n Sorry for crappy quality. Tested on Rpi + Slow Network\n\n### Advanced Demo : \n\n ![Advanced Demo](https://raw.githubusercontent.com/sahilchaddha/homebridge-dafang/master/demo-advanced.gif)\n\n### Simple Demo : \n\n ![Simple Demo](https://raw.githubusercontent.com/sahilchaddha/homebridge-dafang/master/demo-simple.gif)\n\n### Rich Notifications : \n\n\u003cimg src=\"https://raw.githubusercontent.com/sahilchaddha/homebridge-dafang/master/demo-rich-not.gif\" width=\"300\" height=\"600\" /\u003e\n\n## Plugin Config : \n\n| Config                          | Type                | Description                                           | Config |\n|------------------------------------|---------------------|-------------------------------------------------------|--------|\n| mqtt.hostBroker                      | bool      | Set true to host MQTT Locally, set false to connect to external MQTT Broker.                          | Required|\n| cameras                      | Array (Object)      | Can add Multiple Cameras                          | Required|\n\n\n## Camera Config : \n\n| Config                          | Type                | Description                                           | Config |\n|------------------------------------|---------------------|-------------------------------------------------------|--------|\n| cameraRTSPStreamUrl                      | string      | RTSP Stream Url e.g. `rtsp://192.168.1.2:8554/unicast`                          | Required|\n| disableStream                | bool | Set true to stream camera, set false to disable camera view                      | Optional|\n| mqttTopic                | string | Each Dafang Device must have a unique topic. Topic should match for each corresponding camera accessory                      | Required|\n| folder                | string | Absolute path of directory where recordings/images will be saved                      | Required|\n| segmentLength                | number | Length of each video file. (in seconds). Each recording will be saved in segmented videos. Default : 60 (1 minute)                      | Optional|\n| maxDirSize                | number | Max Size of folder (in mb) where recordings will be saved. Default : 2048 (2GB)                      | Optional|\n| checkStorageSizeInterval                | number | Time in seconds to re check recording folder size for `storageSensor`. Default : 300 (5 min)                      | Optional|\n| recordingDirectoryPathFormat                | string | DateTime format for Recordings Directory Path. Default : `MMM-Do-YY`                      | Optional|\n| recordingFilenameFormat                | string | DateTime format for Recordings Filename. Default : `YYYY-M-D-h-mm-ss` | Optional|\n\nRefer to https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/ for custom DirectoryPath/FileName formats for recordings..\n\n```json\n{\n    \"platforms\": [\n        {\n            \"platform\": \"Dafang\",\n            \"mqtt\": {\n                \"hostBroker\": true,\n                \"port\": 1883,\n                \"host\": \"localhost\",\n                \"debug\": true,\n                \"mongoUrl\": \"mongodb://localhost:27017/mqtt\"\n            },\n            \"cameras\": [{\n                \"cameraName\": \"My Dafang\",\n                \"cameraRTSPStreamUrl\": \"rtsp://192.168.1.12:8554/unicast\",\n                \"mqttTopic\": \"myhome/dafang/#\",\n                \"folder\": \"/Users/sahilchaddha/Sahil/Recordings/\",\n                \"accessories\": [\n                                    {\n                                        \"name\": \"Living Room Motion Sensor\",\n                                        \"type\": \"richMotionSensor\",\n                                        \"threshold\": 300000\n                                    },\n                                    {\n                                        \"name\": \"Living Room Auto Motion Tracking Switch\",\n                                        \"type\": \"autoMotionTrackingSwitch\"\n                                    },\n                                    {\n                                        \"name\": \"Living Room Night Vision Sensor\",\n                                        \"type\": \"nightVisionSensor\",\n                                        \"threshold\": 0\n                                    },\n                                    {\n                                        \"name\": \"Living Room Night Vision Switch\",\n                                        \"type\": \"nightVisionSwitch\"\n                                    },\n                                    {\n                                        \"name\": \"Living Room Auto Night Vision Switch\",\n                                        \"type\": \"autoNightVisionSwitch\"\n                                    },\n                                    {\n                                        \"name\": \"Horizontal Left\",\n                                        \"type\": \"moveCamera\",\n                                        \"axis\": \"horizontal\",\n                                        \"direction\": \"left\"\n                                    },\n                                    {\n                                        \"name\": \"Horizontal Right\",\n                                        \"type\": \"moveCamera\",\n                                        \"axis\": \"horizontal\",\n                                        \"direction\": \"right\"\n                                    },\n                                    {\n                                        \"name\": \"Vertical Up\",\n                                        \"type\": \"moveCamera\",\n                                        \"axis\": \"vertical\",\n                                        \"direction\": \"up\"\n                                    },\n                                    {\n                                        \"name\": \"Vertical Down\",\n                                        \"type\": \"moveCamera\",\n                                        \"axis\": \"vertical\",\n                                        \"direction\": \"down\"\n                                    },\n                                    {\n                                        \"name\": \"Record Video\",\n                                        \"type\": \"recordVideo\"\n                                    },\n                                    {\n                                        \"name\": \"Record Audio\",\n                                        \"type\": \"recordAudio\"\n                                    },\n                                    {\n                                        \"name\": \"Capture Image\",\n                                        \"type\": \"captureImage\"\n                                    },\n                                    {\n                                        \"name\": \"RPi Storage Sensor\",\n                                        \"type\": \"storageSensor\"\n                                    },\n                                    {\n                                        \"name\": \"Clear Storage Switch\",\n                                        \"type\": \"clearStorage\"\n                                    },\n                                    {\n                                        \"name\": \"Reset Streaming\",\n                                        \"type\": \"resetFFMPEG\"\n                                    },\n                                    {\n                                        \"name\": \"Camera Brightness\",\n                                        \"type\": \"brightness\"\n                                    }\n                    ]\n            }]\n        }\n    ]\n}\n```\n\n## Lint\n\n```shell\n    $ npm run lint\n```\n\n## Need Help ?\n\nGet Slack Invite =\u003e `https://slackin-znyruquwmv.now.sh/`\n\nSlack Channel =\u003e `https://homebridgeteam.slack.com/messages/homebridge-dafang`\n\nSlack User =\u003e `@sahilchaddha`\n\n### Author\n\nSahil Chaddha\n\nmail@sahilchaddha.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahilchaddha%2Fhomebridge-dafang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsahilchaddha%2Fhomebridge-dafang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahilchaddha%2Fhomebridge-dafang/lists"}