Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function hapDiscovery(options) {
homebridge = new HAPNodeJSClient(options);
homebridge.on('Ready', function() {
alexaDiscovery.call(options, null, function() {
// debug("Events", options);
if (options.oldParser) {
registerEvents(alexaTranslator.hapEndPoints());
} else {
registerEvents(hbDevices.toEvents());
}
});
});
homebridge.on('hapEvent', function(event) {
// debug("Event Relay - 2", event);
options.eventBus.emit('hapEvent', event);
});
function hbConf(n) {
RED.nodes.createNode(this, n);
this.username = n.username;
this.password = this.credentials.password;
this.users = {};
if (!homebridge) {
homebridge = new HAPNodeJSClient({
"pin": n.username,
"refresh": 900,
"debug": true,
"timeout": 20,
"reqTimeout": 7000
});
reqisterQueue.pause();
homebridge.on('Ready', function(accessories) {
// evDevices = register.registerEv(homebridge, accessories);
// ctDevices = register.registerCt(homebridge, accessories);
hbDevices = new Homebridges(accessories);
// debug("output", JSON.stringify(hbDevices.toList({ perms: 'ev'}), null, 4));
// debug("evDevices", evDevices);
// debug('Discovered %s evDevices', evDevices.length);
debug('Discovered %s new evDevices', hbDevices.toList({
perms: 'ev'