How to use the node-hue-api.upnpSearch function in node-hue-api

To help you get started, we’ve selected a few node-hue-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cheshire137 / hue-steamer / app.js View on Github external
getLightStatus(group.lights[i]);
  }
};
var displayBridge = function(bridge) {
  console.log('Bridge "' + bridge.name + '"');
  console.log("\tTime: " + bridge.localtime);
  console.log("\tAPI version: " + bridge.apiversion);
  api.getGroup('0').then(displayGroup).done();
};
// api.config().then(displayBridge).done();

var displayBridges = function(bridge) {
    console.log("Hue Bridges Found: " + JSON.stringify(bridge));
};

hue.upnpSearch(2000).then(displayBridges).done();

// // var redX = 0.6417, redY = 0.304;
// // var blueX = 0.168, blueY = 0.041;
// // // var state = lightState.create().on().xy(redX, redY);
// // var state = lightState.create().on().effect('none');

// // api.setLightState(lightID, state).
// //     then(displayLightState).fail(displayError).done();
github SphtKr / homebridge-zway / PhilipsHue.js View on Github external
hue.nupnpSearch(function (locateError, bridges) {
    if (locateError) {
      that.log("Philips Hue bridge discovery with meethue.com failed. Register your bridge with the meethue.com for more reliable discovery.");

      that.log("Attempting to discover Philips Hue bridge with network scan...");

      // Timeout after one minute
      hue.upnpSearch(60000)
        .then(function (bridges) {
          that.log("Scan complete");
          getIp(null, bridges);
        })
        .fail(function (scanError) {
          that.log("Philips Hue bridge discovery with network scan failed. Check your network connection or set ip_address manually in configuration.");
          getIp(new Error("Scan failed: " + scanError.message));
        }).done();
    } else {
      getIp(null, bridges);
    }
  });
};
github ecaron / smart-nightlight-manager / setup.js View on Github external
console.warn(err.message);
        return;
      }
      databaseModel.bridge.push({ ip: bridge[0].ipaddress, username: newUser });
      jsonfile.writeFile('./config/db2.json', databaseModel, function (err) {
        if (err) {
          console.error(err);
        } else {
          console.log('Database is setup. You may run "npm start"');
        }
      });
    }
  );
};

HueApi.upnpSearch(timeout).then(displayBridges).done();
github thkl / Homematic-Virtual-Interface / plugins / HuePlugin / HuePlatform.js View on Github external
HuePlatform.prototype.locateBridge = function (callback) {
	var that = this
	this.log.info("trying to find your Hue bridge ...")
	var hue = require("node-hue-api")
	
	hue.upnpSearch(6000).then(function (bridges) {
		if ((bridges != undefined) && (bridges.length > 0)) {
		  that.log.info("Scan complete",bridges[0].ipaddress)
          that.hue_ipAdress = bridges[0].ipaddress
          callback(null,undefined)
		} else {
          that.log.warn("Scan complete but no bridges found")
          callback(null,null)
		}
    }).done().catch(function(_data) {
		that.log.error("locateBridge %s",_data)
	})
    
}
github wellsjo / LeapMotion-Hue-Controller / app / hue.js View on Github external
upnpSearch: function(timeout, callback) {
        hueapi.upnpSearch(timeout).then(function(result) {
            callback(result);
        }).done();
    },
github kvartborg / hueify / src / helpers / connectToHue.js View on Github external
searchForBrigde () {
    hue.upnpSearch(3000)
      .then(bridge => {
        if (bridge.length === 0) {
          return
        }

        store.dispatch(setHost(bridge[0].ipaddress))
      })
      .done(() =>
        this.connect()
      )
  }