Skip to content

Commit

Permalink
camera: add doorbell option (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Jan 2, 2020
1 parent 9712ae4 commit 23aee94
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nodes/redmatic-homekit-camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
audio: {value: '', type: 'boolean'},
debug: {value: false, type: 'boolean'},
packetSize: {value: 1316},
maxBitrate: {value: 300}
maxBitrate: {value: 300},
doorbell: {value: false, type: 'boolean'}
},
inputs: 0,
inputs: 1,
outputs: 0,
icon: 'homekit2.png',
color: '#E2D96E',
Expand Down Expand Up @@ -133,6 +134,11 @@
<div style="width: 70%; display: inline-block; vertical-align: text-top;">
<label><input type="checkbox" style="width: auto !important; margin-top: -3px;" id="node-input-debug"> Enabled</label>
</div>
<div class="form-row">
<label for="node-input-doorbell"><i class="icon-tag"></i> doorbell</label>
<div style="width: 70%; display: inline-block; vertical-align: text-top;">
<label><input type="checkbox" style="width: auto !important; margin-top: -3px;" id="node-input-doorbell"> Enabled</label>
</div>
<div class="form-fow" style="padding-top: 20px; display: flex; justify-content: center;">
<div id="qrcode" style=""></div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions nodes/redmatic-homekit-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,19 @@ module.exports = function (RED) {

config.audio = Boolean(config.audio);

if (config.doorbell) {
this.debug('add doorbell service');
const doorbellService = acc.addService(hap.Service.Doorbell, this.name);
this.on('input', msg => {
console.log(msg);
this.debug('update ProgrammableSwitchEvent SINGLE_PRESS');
doorbellService.getCharacteristic(hap.Characteristic.ProgrammableSwitchEvent).updateValue(0);
});
}

const cameraSource = new FFMPEG(hap, {name: this.name, videoConfig: config}, logger, config.videoProcessor || 'ffmpeg');
this.debug('add cameraSource');

acc.configureCameraSource(cameraSource);

this.log('publishing camera ' + this.name + ' ' + config.username);
Expand Down

0 comments on commit 23aee94

Please sign in to comment.