You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating an application that uses the node-hue-api by Peter Murray. So what I do is open the emulator with sudo powers (Mac OSX user) and I change the port to 80. When I want to 'search' the bridge I can't find it either with nupnp and upnp. When I go to https://www.meethue.com/api/nupnp => It gives me this output: []
Would maybe someone could help me out? If you want more information please ask me.
If so, to confirm it is working (if on port 80), you can just use: http://127.0.0.1/api/newdeveloper . (or > your Local IP Address from ipconfig/all or ifconfig). To be honest I never tested the QuickStart App with > an Android Emulator, as I always had a n actual device. I will try this later on today and report back if I > find out anything.
This is the snippet I'm using:
`router.route('/lights')
.get(function(req, res, next) {
bridges.showAllLights();
})
var path = require('path');
var pathToJson = path.resolve(__dirname, '../../config/config.json');
// Load config
var config = require(pathToJson);
// START IMPORT NODE HUE API
var hue = require("node-hue-api"),
HueApi = hue.HueApi,
lightState = hue.lightState;
var displayResult = function(result) {
console.log(result);
};
var displayError = function(err) {
console.error(err);
};
var api = new HueApi(config.bridge.host, config.bridge.username),
state = lightState.create();
Hi there,
I have never used the node-hue-api so I can't really help you on the above code. In your first sentence you say you are changing to port 80, but you then go on to mention you are can't see anything on: http://localhost:46302/lights. Are you running the emulator on port 46302 or 80? In any case http://localhost:/lights should work, providing you have localhost setup in your hosts file. If not you can always use 127.0.0.1 to be sure.
For your searching issue, the emulator UPnP doesn't work that great. I have mentioned this on some other issues previously so for now you will have to manually hard-code the IP Address.
The NUPnP URL would never work though. When you buy a real hue bridge it registers the IP address on the meethue site, which allows it to be found (using the meethue.com/api/nupnp url). This cant be done via an emulator.
Hope this clarifies a little.
Steve
I'm creating an application that uses the node-hue-api by Peter Murray. So what I do is open the emulator with sudo powers (Mac OSX user) and I change the port to 80. When I want to 'search' the bridge I can't find it either with nupnp and upnp. When I go to https://www.meethue.com/api/nupnp => It gives me this output:
[]
Would maybe someone could help me out? If you want more information please ask me.
EDIT:
I've found this post of you SteveyO
I can confirm its working on http://127.0.0.1/api/newdeveloper.
When i go to http://localhost:46302/lights it must give me the output of all the lights but I'm not recieving anything.
This is the snippet I'm using:
`router.route('/lights')
.get(function(req, res, next) {
bridges.showAllLights();
})
var path = require('path');
var pathToJson = path.resolve(__dirname, '../../config/config.json');
// Load config
var config = require(pathToJson);
// START IMPORT NODE HUE API
var hue = require("node-hue-api"),
HueApi = hue.HueApi,
lightState = hue.lightState;
var displayResult = function(result) {
console.log(result);
};
// END IMPORT NODE HUE API
var Bridges = function() {
this.bridge = "";
};
Bridges.prototype = {
setBridge: function(bridge){
this.bridge = bridge;
},
};
var Phue = function() {
this.showAllLights = function() {
api.lights(function(err, lights) {
if (err) throw err;
displayResult(lights);
});
},
this.getStatusOfLamp = function(id){
api.lightStatus(id, function(err, result) {
if (err) throw err;
displayStatus(result);
});
},
this.setLightState = function(id, state){
if(state == 'on'){
api.setLightState(id, state.on(), function(err, result) {
if (err) throw err;
displayResult(result);
});
} else {
api.setLightState(id, state.off(), function(err, result) {
if (err) throw err;
displayResult(result);
});
}
};
`
The text was updated successfully, but these errors were encountered: