Skip to content

Commit

Permalink
v1.2.1 (#524)
Browse files Browse the repository at this point in the history
* Update package.json

* Update CHANGELOG.md

* motion switch cleanups - Fixes #522 (#523)

* v1.2.1

Co-authored-by: Normen Hansen <normen667@gmail.com>
  • Loading branch information
donavanbecker and normen authored May 28, 2020
1 parent a62efb5 commit 51886b0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).

## v1.2.1 (2020-05-28)

### Changes
* Fixes [#522](/~https://github.com/homebridge-plugins/homebridge-camera-ffmpeg/issues/522), Cleans Up and Condenses the code around the motion switch.

## v1.2.0 (2020-05-27)

### Changes
Expand Down
28 changes: 10 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
switchService.getCharacteristic(Characteristic.On)
.on('set', function(state, callback){
if(state){
cameraAccessory.getService(Service.Doorbell).getCharacteristic(Characteristic.ProgrammableSwitchEvent).setValue(0);
doorbellService.getCharacteristic(Characteristic.ProgrammableSwitchEvent).setValue(0);
setTimeout(function(){
switchService.getCharacteristic(Characteristic.On).updateValue(false);
}, 1000);
Expand All @@ -95,7 +95,15 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
cameraAccessory.addService(motion);

button.getCharacteristic(Characteristic.On)
.on('set', _Motion.bind(cameraAccessory));
.on('set', function(state, callback){
motion.setCharacteristic(Characteristic.MotionDetected, (state ? 1 : 0));
if(state){
setTimeout(function(){
button.getCharacteristic(Characteristic.On).updateValue(false);
}, 5000);
}
callback(null, state);
});
}

var cameraSource = new FFMPEG(hap, cameraConfig, self.log, self.config.videoProcessor, interfaceName);
Expand All @@ -106,19 +114,3 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
self.api.publishCameraAccessories("homebridge-camera-ffmpeg", configuredAccessories);
}
};

function _Motion(on, callback) {
this.context.log("Setting %s Motion to %s", this.displayName, on);

this.getService(Service.MotionSensor).setCharacteristic(Characteristic.MotionDetected, (on ? 1 : 0));
if (on) {
setTimeout(_Reset.bind(this), 5000);
}
callback();
}

function _Reset() {
this.context.log("Setting %s Button to false", this.displayName);

this.getService(Service.Switch).setCharacteristic(Characteristic.On, false);
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Homebridge Camera FFmpeg",
"name": "homebridge-camera-ffmpeg",
"version": "1.2.0",
"version": "1.2.1",
"description": "ffmpeg plugin for homebridge: /~https://github.com/homebridge/homebridge",
"license": "ISC",
"keywords": [
Expand Down

0 comments on commit 51886b0

Please sign in to comment.