@@ -77,7 +77,7 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
77
77
switchService . getCharacteristic ( Characteristic . On )
78
78
. on ( 'set' , function ( state , callback ) {
79
79
if ( state ) {
80
- cameraAccessory . getService ( Service . Doorbell ) . getCharacteristic ( Characteristic . ProgrammableSwitchEvent ) . setValue ( 0 ) ;
80
+ doorbellService . getCharacteristic ( Characteristic . ProgrammableSwitchEvent ) . setValue ( 0 ) ;
81
81
setTimeout ( function ( ) {
82
82
switchService . getCharacteristic ( Characteristic . On ) . updateValue ( false ) ;
83
83
} , 1000 ) ;
@@ -95,7 +95,15 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
95
95
cameraAccessory . addService ( motion ) ;
96
96
97
97
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
+ } ) ;
99
107
}
100
108
101
109
var cameraSource = new FFMPEG ( hap , cameraConfig , self . log , self . config . videoProcessor , interfaceName ) ;
@@ -106,19 +114,3 @@ ffmpegPlatform.prototype.didFinishLaunching = function() {
106
114
self . api . publishCameraAccessories ( "homebridge-camera-ffmpeg" , configuredAccessories ) ;
107
115
}
108
116
} ;
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
- }
0 commit comments