hap-node-client
Advanced tools
Comparing version 0.1.12 to 0.1.13
@@ -13,3 +13,3 @@ 'use strict'; | ||
var discovered = []; | ||
var mdnsCache = []; | ||
var mdnsCache = {}; | ||
var populateCache = false; | ||
@@ -129,2 +129,7 @@ | ||
// debug('refreshed', mdnsCache[deviceID]); | ||
var pin = _findPinByKey(deviceID); | ||
var host = mdnsCache[deviceID].host + ':' + mdnsCache[deviceID].port; | ||
this.RegisterPin(host, pin); | ||
callback(null, mdnsCache[deviceID]); | ||
@@ -261,3 +266,3 @@ } else { | ||
callback(err, response); | ||
}); | ||
}, instance); | ||
} | ||
@@ -276,5 +281,5 @@ }.bind(this)); | ||
HAPNodeJSClient.prototype.HAPcontrol = function(ipAddress, port, body, callback) { | ||
var host = ipAddress + ':' + port; | ||
var pin = _findPinByKey(host); | ||
HAPNodeJSClient.prototype.HAPcontrol = function(ipAddress, port, body, callback, instance) { | ||
var pin = _findPinByKey(instance ? instance.deviceID : ipAddress + ':' + port); | ||
request({ | ||
@@ -426,3 +431,2 @@ eventBus: this._eventBus, | ||
} else { | ||
var host = instance.host + ':' + instance.port; | ||
var pin = _findPinByKey(deviceID); | ||
@@ -462,3 +466,2 @@ | ||
var rsp; | ||
this.RegisterPin(host, pin); | ||
@@ -500,5 +503,4 @@ if (!this.eventRegistry[deviceID]) { | ||
HAPNodeJSClient.prototype.HAPevent = function(ipAddress, port, body, callback) { | ||
var host = ipAddress + ':' + port; | ||
var pin = _findPinByKey(host); | ||
HAPNodeJSClient.prototype.HAPevent = function(ipAddress, port, body, callback, instance) { | ||
var pin = _findPinByKey(instance ? instance.deviceID : ipAddress + ':' + port); | ||
hapRequest({ | ||
@@ -578,3 +580,3 @@ eventBus: this._eventBus, | ||
callback(err, response); | ||
}); | ||
}, instance); | ||
} | ||
@@ -593,5 +595,4 @@ }.bind(this)); | ||
HAPNodeJSClient.prototype.HAPresource = function(ipAddress, port, body, callback) { | ||
var host = ipAddress + ':' + port; | ||
var pin = _findPinByKey(host); | ||
HAPNodeJSClient.prototype.HAPresource = function(ipAddress, port, body, callback, instance) { | ||
var pin = _findPinByKey(instance ? instance.deviceID : ipAddress + ':' + port); | ||
@@ -661,3 +662,3 @@ request({ | ||
callback(err, response); | ||
}); | ||
}, instance); | ||
} | ||
@@ -676,5 +677,4 @@ }.bind(this)); | ||
HAPNodeJSClient.prototype.HAPstatus = function(ipAddress, port, body, callback) { | ||
var host = ipAddress + ':' + port; | ||
var pin = _findPinByKey(host); | ||
HAPNodeJSClient.prototype.HAPstatus = function(ipAddress, port, body, callback, instance) { | ||
var pin = _findPinByKey(instance ? instance.deviceID : ipAddress + ':' + port); | ||
@@ -681,0 +681,0 @@ // debug('HAPstatus', pin); |
{ | ||
"name": "hap-node-client", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "Client for Hap-NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "HAPNodeJSClient.js", |
71991
1736