mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Minor Tweak
This commit is contained in:
@@ -140,6 +140,11 @@ PlatformAccessory.prototype.configureCameraSource = function(cameraSource) {
|
|||||||
|
|
||||||
PlatformAccessory.prototype._prepareAssociatedHAPAccessory = function () {
|
PlatformAccessory.prototype._prepareAssociatedHAPAccessory = function () {
|
||||||
this._associatedHAPAccessory = new Accessory(this.displayName, this.UUID);
|
this._associatedHAPAccessory = new Accessory(this.displayName, this.UUID);
|
||||||
|
|
||||||
|
if (this.cameraSource) {
|
||||||
|
this._associatedHAPAccessory.configureCameraSource(this.cameraSource);
|
||||||
|
}
|
||||||
|
|
||||||
this._associatedHAPAccessory._sideloadServices(this.services);
|
this._associatedHAPAccessory._sideloadServices(this.services);
|
||||||
this._associatedHAPAccessory.category = this.category;
|
this._associatedHAPAccessory.category = this.category;
|
||||||
this._associatedHAPAccessory.reachable = this.reachable;
|
this._associatedHAPAccessory.reachable = this.reachable;
|
||||||
|
|||||||
@@ -462,12 +462,14 @@ Server.prototype._handleUnregisterPlatformAccessories = function(accessories) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Server.prototype._handlePublishCameraAccessories = function(accessories) {
|
Server.prototype._handlePublishCameraAccessories = function(accessories) {
|
||||||
|
var accessoryPin = (this._config.bridge || {}).pin || "031-45-154";
|
||||||
|
|
||||||
for (var index in accessories) {
|
for (var index in accessories) {
|
||||||
var accessory = accessories[index];
|
var accessory = accessories[index];
|
||||||
|
|
||||||
accessory._prepareAssociatedHAPAccessory();
|
accessory._prepareAssociatedHAPAccessory();
|
||||||
var hapAccessory = accessory._associatedHAPAccessory;
|
var hapAccessory = accessory._associatedHAPAccessory;
|
||||||
var advertiseAddress = mac.generate(accessory.uuid);
|
var advertiseAddress = mac.generate(accessory.UUID);
|
||||||
|
|
||||||
if (this._publishedCameras[advertiseAddress]) {
|
if (this._publishedCameras[advertiseAddress]) {
|
||||||
throw new Error("Camera accessory %s experienced an address collision.", accessory.displayName);
|
throw new Error("Camera accessory %s experienced an address collision.", accessory.displayName);
|
||||||
@@ -475,9 +477,13 @@ Server.prototype._handlePublishCameraAccessories = function(accessories) {
|
|||||||
this._publishedCameras[advertiseAddress] = accessory;
|
this._publishedCameras[advertiseAddress] = accessory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hapAccessory.on('listening', function(port) {
|
||||||
|
log.info("%s is running on port %s.", accessory.displayName, port);
|
||||||
|
});
|
||||||
|
|
||||||
hapAccessory.publish({
|
hapAccessory.publish({
|
||||||
username: advertiseAddress,
|
username: advertiseAddress,
|
||||||
pincode: bridgeConfig.pin || "031-45-154",
|
pincode: accessoryPin,
|
||||||
category: accessory.category
|
category: accessory.category
|
||||||
}, this._allowInsecureAccess);
|
}, this._allowInsecureAccess);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user