Skip to content

Commit 3ef7ae3

Browse files
committed
Add support to trigger doorbell by motion
1 parent 7d82224 commit 3ef7ae3

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Other users have been sharing configurations that work for them on our GitHub si
5858
- `doorbell`: Exposes the doorbell device for this camera. This can be triggered with [dummy switches](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/switch.html), [MQTT messages](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/mqtt.html), or [via HTTP](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/http.html), depending on what features are enabled in the config. (Default: `false`)
5959
- `switches`: Enables dummy switches to trigger motion and/or doorbell, if either of those are enabled. When enabled there will be an additional switch that triggers the motion or doorbell event. See the project site for [more detailed instructions](https://sunoo.github.io/homebridge-camera-ffmpeg/automation/switch.html). (Default: `false`)
6060
- `motionTimeout`: The number of seconds after triggering to reset the motion sensor. Set to 0 to disable resetting of motion trigger for MQTT or HTTP. (Default: `1`)
61+
- `motionDoorbell`: Rings the doorbell when motion is activated. This allows for motion alerts to appear on Apple TVs. (Default: `false`)
6162
- `manufacturer`: Set the manufacturer name for display in the Home app. (Default: `Homebridge`)
6263
- `model`: Set the model for display in the Home app. (Default: `Camera FFmpeg`)
6364
- `serialNumber`: Set the serial number for display in the Home app. (Default: `SerialNumber`)

config.schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@
124124
"minimum": 0,
125125
"description": "The number of seconds after triggering to reset the motion sensor. Set to 0 to disable resetting of motion trigger for MQTT or HTTP."
126126
},
127+
"motionDoorbell": {
128+
"title": "Trigger Doorbell with Motion",
129+
"type": "boolean",
130+
"description": "Rings the doorbell when motion is activated. This allows for motion alerts to appear on Apple TVs."
131+
},
127132
"unbridge": {
128133
"title": "Unbridge Camera",
129134
"type": "boolean",
@@ -344,7 +349,8 @@
344349
"cameras[].motion",
345350
"cameras[].doorbell",
346351
"cameras[].switches",
347-
"cameras[].motionTimeout"
352+
"cameras[].motionTimeout",
353+
"cameras[].motionDoorbell"
348354
]
349355
}
350356
]

src/configTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type CameraConfig = {
2626
doorbell?: boolean;
2727
switches?: boolean;
2828
motionTimeout?: number;
29+
motionDoorbell?: boolean;
2930
unbridge?: boolean;
3031
videoConfig?: VideoConfig;
3132
};

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,15 @@ class FfmpegPlatform implements DynamicPlatformPlugin {
225225
}
226226
const motionTrigger = accessory.getServiceById(hap.Service.Switch, 'MotionTrigger');
227227
if (active) {
228+
const config = this.cameraConfigs.get(accessory.UUID);
228229
motionSensor.updateCharacteristic(hap.Characteristic.MotionDetected, true);
229230
if (motionTrigger) {
230231
motionTrigger.updateCharacteristic(hap.Characteristic.On, true);
231232
}
232-
let timeoutConfig = this.cameraConfigs.get(accessory.UUID)?.motionTimeout ?? 1;
233+
if (config?.motionDoorbell) {
234+
this.doorbellHandler(accessory, true);
235+
}
236+
let timeoutConfig = config?.motionTimeout ?? 1;
233237
if (timeoutConfig < minimumTimeout) {
234238
timeoutConfig = minimumTimeout;
235239
}

0 commit comments

Comments
 (0)