Skip to content

Commit 51886b0

Browse files
v1.2.1 (#524)
* Update package.json * Update CHANGELOG.md * motion switch cleanups - Fixes #522 (#523) * v1.2.1 Co-authored-by: Normen Hansen <normen667@gmail.com>
1 parent a62efb5 commit 51886b0

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

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

5+
## v1.2.1 (2020-05-28)
6+
7+
### Changes
8+
* Fixes [#522](https://github.com/homebridge-plugins/homebridge-camera-ffmpeg/issues/522), Cleans Up and Condenses the code around the motion switch.
9+
510
## v1.2.0 (2020-05-27)
611

712
### Changes

index.js

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
7777
switchService.getCharacteristic(Characteristic.On)
7878
.on('set', function(state, callback){
7979
if(state){
80-
cameraAccessory.getService(Service.Doorbell).getCharacteristic(Characteristic.ProgrammableSwitchEvent).setValue(0);
80+
doorbellService.getCharacteristic(Characteristic.ProgrammableSwitchEvent).setValue(0);
8181
setTimeout(function(){
8282
switchService.getCharacteristic(Characteristic.On).updateValue(false);
8383
}, 1000);
@@ -95,7 +95,15 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
9595
cameraAccessory.addService(motion);
9696

9797
button.getCharacteristic(Characteristic.On)
98-
.on('set', _Motion.bind(cameraAccessory));
98+
.on('set', function(state, callback){
99+
motion.setCharacteristic(Characteristic.MotionDetected, (state ? 1 : 0));
100+
if(state){
101+
setTimeout(function(){
102+
button.getCharacteristic(Characteristic.On).updateValue(false);
103+
}, 5000);
104+
}
105+
callback(null, state);
106+
});
99107
}
100108

101109
var cameraSource = new FFMPEG(hap, cameraConfig, self.log, self.config.videoProcessor, interfaceName);
@@ -106,19 +114,3 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
106114
self.api.publishCameraAccessories("homebridge-camera-ffmpeg", configuredAccessories);
107115
}
108116
};
109-
110-
function _Motion(on, callback) {
111-
this.context.log("Setting %s Motion to %s", this.displayName, on);
112-
113-
this.getService(Service.MotionSensor).setCharacteristic(Characteristic.MotionDetected, (on ? 1 : 0));
114-
if (on) {
115-
setTimeout(_Reset.bind(this), 5000);
116-
}
117-
callback();
118-
}
119-
120-
function _Reset() {
121-
this.context.log("Setting %s Button to false", this.displayName);
122-
123-
this.getService(Service.Switch).setCharacteristic(Characteristic.On, false);
124-
}

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"displayName": "Homebridge Camera FFmpeg",
33
"name": "homebridge-camera-ffmpeg",
4-
"version": "1.2.0",
4+
"version": "1.2.1",
55
"description": "ffmpeg plugin for homebridge: https://github.com/homebridge/homebridge",
66
"license": "ISC",
77
"keywords": [

0 commit comments

Comments
 (0)