-
Notifications
You must be signed in to change notification settings - Fork 2
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
Do the light indexes match? #7
Comments
PS> I forgot to say, most importantly, thanks for this package. Makes working with the Hue bridge from typescript a breeze! |
Hey Callum, sorry for the late response. The numeric key returned in the response is referred to as an index in my codebase, but it's more like an ID in the official Hue API docs. You need to keep track of the numbers returned by the bridge, as that's how the bridge actually addresses the lamps. I'd be OK with adding it to the Lamp object definition if it would help you out (I have to admit that my bulbs are tucked away in a closet and aren't currently in use). I'll take a look at your PR when you've got it all set for review. Also, thanks for the kind words, I'm glad you've had success using the library! |
Here's the
getLamps()
code:hue-hacking-npm/src/hue-node.ts
Lines 585 to 589 in db88160
In the last line, the returned data is converted from an object into an array. The object I see in my tests looks like:
But the resulting array is zero indexed and so to be able to call
setColor
I need a 1 based index. So I end up adding 1 to the index. I'm wondering if this is deliberate. I assume that the Hue API will never skip number, nor return indexes out of sequence, but I can't see any way to actually get the index out of thegetLamps()
response. Would you be open to a PR which added a field calledindex
to theLamp
type?The text was updated successfully, but these errors were encountered: