sqmk / huejay

Philips Hue client for Node.js
MIT License
424 stars 40 forks source link

`Error: Philips Hue: 101, link button not pressed` -- bug or mistake? #104

Closed Wizek closed 5 years ago

Wizek commented 5 years ago

I'm trying out huejay and running into a strange error when running the following code:

https://gist.github.com/Wizek/443d9f382492edae9e50d1dd4c67ac44

Id: 14F7CC2DE726E378, IP: 192.168.0.2
An error occurred: Philips Hue: 101, link button not pressed Error: Philips Hue: 101, link button not pressed
    at HuejayError (C:\Users\Wizek\sandbox\exp-node-hue-2\node_modules\huejay\lib\Error.js:21:5)
    at getHttpClient.request.then.response (C:\Users\Wizek\sandbox\exp-node-hue-2\node_modules\huejay\lib\Transport.js:88:17)
    at process._tickCallback (internal/process/next_tick.js:109:7)

It appears about a second after the Id+ip combo. Isn't it supposed to wait for 30 seconds? I've also tried without username and timeout specified. Is this a bug or am I supposed to use the lib differently for it to work?

sqmk commented 5 years ago

The bridge button linkage lasts for 30 seconds upon pressing it. Huejay does not do the waiting for you; the command for creating a user assumes you pressed the bridge button already, and if not, will throw that error above.

This behavior is not a bug. You’ll need to create your own polling logic to accomplish this, which shouldn’t be hard to do at all.

Wizek commented 5 years ago

Ah I see. I'll give that a try. Thanks for the clarification.