peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.18k stars 145 forks source link

User creation on bridge v1 not working #147

Closed foxriver76 closed 4 years ago

foxriver76 commented 4 years ago

It seems like that user creation is not possible via createUser Of node-hue-api v3 on the v1 bridge. Resulting in {"_hueError":{"payload":{"message":"parameter, generateclientkey, not available","type":6,"address":"/generateclientkey","description":"parameter, generateclientkey, not available"}}}

With v2 it worked. Do you have any idea?

peter-murray commented 4 years ago

generateclientkey has been around for a long time now, as it is connected with the entertainment API.

I have used and tested this multiple times under v3.

Can you provide any details on the versions of the configuration of the bridge that this is failing on? The configuration endpoint can be called with authentication, it will just return less information.

peter-murray commented 4 years ago

Ah, just re-read the initial details. So this is a really ancient hardware device that was never upgraded, right?

peter-murray commented 4 years ago

I will need the data from the the http://[bridge-ipaddress]/api/config to be able to implement a work around on this as that will contain some version numbers I can use to remove the generateclientkey parameter when encountered, as this is needed to support the newer bridges.

foxriver76 commented 4 years ago

I will try to get the information asap.

peter-murray commented 4 years ago

I have released 3.4.2 to npm registry to provide a short term work around until we can get the information needed to gate the generateclientkey parameter safely.

The v3.users.createUser() function now supports a noClientKey third parameter to suppress the request for the clientkey when creating a new user.

So the call to the bridge via the library would now be:

hueClient.users.createUser('appName', 'deviceName', true);

It has to be true so that it has zero impact on existing code bases using this function until I can gate it properly based on bridge api version numbers.

foxriver76 commented 4 years ago

Thank you {"name":"Philips hue","datastoreversion":"59","swversion":"01041302","apiversion":"1.16.0","mac":"00:12:88:15:fb:93","bridgeid":"001788FFFE14FB93","factorynew":false,"replacesbridgeid":null,"modelid":"BSB001"}

peter-murray commented 4 years ago

Version 3.4.3 is in the npm registry with the long term fix applied.

It now looks at the modelid reported from the bridge to decide if it should set the generateclientkey in the parameters.

foxriver76 commented 4 years ago

Confirmed -- works! Thank you very much for the quick fix. I really appreciate this. :+1: