mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Forward identity only if plugin cares about event
This commit is contained in:
@@ -131,7 +131,13 @@ PlatformAccessory.prototype._prepareAssociatedHAPAccessory = function () {
|
||||
this._associatedHAPAccessory._sideloadServices(this.services);
|
||||
this._associatedHAPAccessory.reachable = this.reachable;
|
||||
this._associatedHAPAccessory.on('identify', function(paired, callback) {
|
||||
this.emit('identify', paired, callback);
|
||||
if (this.listeners('identify').length > 0) {
|
||||
// allow implementors to identify this Accessory in whatever way is appropriate, and pass along
|
||||
// the standard callback for completion.
|
||||
this.emit('identify', paired, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user