Closed jcklpe closed 5 years ago
This should help:
https://github.com/sqmk/huejay#clientuserscreate---create-user
Additionally, I do not believe you need to provide a username to the client when attempting to create a user via the create user API linked.
@sqmk Cool, so just to clarify that link is about creating a new user. Is this user just a thing that HueJay uses or is it something which actually runs natively on the bridge that is being accessed by api?
If it's the latter then shouldn't I already have one? How would I access that one instead creating a new one? Or is there a reason why I should create a new one for HueJay?
It's a resource managed by the Philips Hue bridge. You can view the example scripts in this repository to create a brand new user/key, which you need to be able to use nearly all the other APIs exposed by the bridge.
There may be a user created on the bridge already if you have used the Philips Hue app to control your lights. The Hue app doesn't expose what that is. You'll need to do some sniffing on your network to retrieve that user. Or you can just follow the create user example scripts in the repo: https://github.com/sqmk/huejay/blob/master/examples/users/create-user.js
Cool. I do have the official Hue app already installed, but it sounds like creating a user is just as easy and effective so I will do that. Thank you!
Yup. You press the button on the bridge, I think it's active for 15 or 30 seconds, and in that window, you can use Huejay to request a new user from the bridge. The new user is returned by the bridge's API, and you can use that user to control the bridge going forward.
Oooh so the user name is determined by the API? I'm not supposed to edit the create user file with my own input?
Sorry to ask so many questions, I just want to double check that I understand.
The bridge itself generates usernames. Think of them as randomly generated API keys. Just don’t provide a “username” on client instantiation when you are attempting to create your first user. I think I note it as optional in the readme.
As posted earlier, RTFM: https://github.com/sqmk/huejay/blob/master/README.md#clientuserscreate---create-user
Sure thing. What I was trying to understand is what the mental schema for "usernames" was intended in this case. Thank you for the help.
Is this this in the Hue app or what?
I already have my bridge and lights all set up. I mostly use an android app called Hue Essentials to control my lights but I wanted to check out what I could do on my own using a node project like Huejay. I can find my IP, but to make the client I need the username and I'm not sure where to find that info.