hap-node-client
Advanced tools
Comparing version 0.0.21 to 0.0.22
@@ -107,22 +107,26 @@ "use strict"; | ||
// debug('Found an HAP server:', instance); | ||
debug("HAP Device discovered", instance.txt.md, instance.addresses); | ||
var ipAddress; | ||
for (let address of instance.addresses) { | ||
if (ip.isV4Format(address)) { | ||
ipAddress = address; | ||
break; | ||
if (instance.txt) { | ||
debug("HAP Device discovered", instance.txt.md, instance.addresses); | ||
var ipAddress; | ||
for (let address of instance.addresses) { | ||
if (ip.isV4Format(address)) { | ||
ipAddress = address; | ||
break; | ||
} | ||
} | ||
} | ||
debug("HAP instance address: %s -> %s -> %s:%s", instance.txt.md, instance.host, ipAddress, instance.port); | ||
_getAccessories.call(this, ipAddress, instance, function(err, data) { | ||
if (!err) { | ||
debug("Homebridge instance discovered %s with %s accessories", instance.name, Object.keys(data.accessories.accessories).length); | ||
if (Object.keys(data.accessories.accessories).length > 0) { | ||
discovered.push(data); | ||
debug("HAP instance address: %s -> %s -> %s:%s", instance.txt.md, instance.host, ipAddress, instance.port); | ||
_getAccessories.call(this, ipAddress, instance, function(err, data) { | ||
if (!err) { | ||
debug("Homebridge instance discovered %s with %s accessories", instance.name, Object.keys(data.accessories.accessories).length); | ||
if (Object.keys(data.accessories.accessories).length > 0) { | ||
discovered.push(data); | ||
} | ||
} else { | ||
// Error, no data | ||
} | ||
} else { | ||
// Error, no data | ||
} | ||
}); | ||
}); | ||
} else { | ||
debug("Unsupported device found, skipping", instance.host, instance.addresses); | ||
} | ||
}.bind(this)); | ||
@@ -129,0 +133,0 @@ |
{ | ||
"name": "hap-node-client", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "Client for Hap-NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "HAPNodeJSClient.js", |
35063
901