From 0af8a43dc9da8f4aa59984a609f531fa7d384919 Mon Sep 17 00:00:00 2001 From: Khaos Tian Date: Fri, 8 Apr 2016 23:50:18 -0700 Subject: [PATCH] Expose platform accessory category to hap-nodejs Fix an error in plugin config look up --- lib/platformAccessory.js | 1 + lib/server.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/platformAccessory.js b/lib/platformAccessory.js index cbb882e..1680823 100644 --- a/lib/platformAccessory.js +++ b/lib/platformAccessory.js @@ -133,6 +133,7 @@ PlatformAccessory.prototype.updateReachability = function(reachable) { PlatformAccessory.prototype._prepareAssociatedHAPAccessory = function () { this._associatedHAPAccessory = new Accessory(this.displayName, this.UUID); this._associatedHAPAccessory._sideloadServices(this.services); + this._associatedHAPAccessory.category = this.category; this._associatedHAPAccessory.reachable = this.reachable; this._associatedHAPAccessory.on('identify', function(paired, callback) { if (this.listeners('identify').length > 0) { diff --git a/lib/server.js b/lib/server.js index 37b13d9..0fc54d0 100644 --- a/lib/server.js +++ b/lib/server.js @@ -466,7 +466,7 @@ Server.prototype._handleNewConfig = function(type, name, replace, config) { this._config.accessories.push(config); } else { var targetName; - if (name.indexOf('.') == -1) { + if (name.indexOf('.') !== -1) { targetName = name.split(".")[1]; } var found = false; @@ -498,7 +498,7 @@ Server.prototype._handleNewConfig = function(type, name, replace, config) { this._config.platforms.push(config); } else { var targetName; - if (name.indexOf('.') == -1) { + if (name.indexOf('.') !== -1) { targetName = name.split(".")[1]; }