Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't recieve any outputs #88

Closed
JensGryspeert opened this issue Mar 30, 2016 · 1 comment
Closed

can't recieve any outputs #88

JensGryspeert opened this issue Mar 30, 2016 · 1 comment

Comments

@JensGryspeert
Copy link

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

Hi,

No problem for late reply. Just to confirm, when you say you are using the Hue Emulator, it is this one? http://steveyo.github.io/Hue-Emulator/

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.

Hue Support - Steve

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);
};

var displayError = function(err) {
    console.error(err);
};


var api = new HueApi(config.bridge.host, config.bridge.username),
state = lightState.create();

// END IMPORT NODE HUE API

var Bridges = function() {
this.bridge = "";
};

Bridges.prototype = {
setBridge: function(bridge){
this.bridge = bridge;
},

showAllLights: function() {
},

getStatusOfLamp: function(id){
},

setLightState: function(id, state){
}

};

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);
});
}

}

};
`

I've posted this aswell on SteveyO/Hue-Emulator#29 but I think it's more I'm using not a proper way of the node-hue-api.

@peter-murray
Copy link
Owner

If you are trying to connect with the emulator using the discovery system, I think it will fail. It uses a search mechanism that I don't think the emulator emulates, and the other uses Phillips own discovery endpoint that the emulator cannot interact with.

If you are using the emulator, you should be able to bind to it directly using whatever ip address and port that you bring the emulator up on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants