Closed jens-maus closed 5 years ago
After some more investigation I found the following code passage to be the actual reason for the getGroup(17)
to fail:
https://github.com/peter-murray/node-hue-api/blob/master/hue-api/index.js#L1539
It seems you added some hardcoded maximum number for the group number which as it seems not be valid anymore.
This is related to a change in the bridge software version 1.8:
as of 1.8 the maximum amount of groups is increased from 16 to 64.
Version 1.8 was released 01/05/2017, so it is probably fairly safe to make the change to 64 now, I will fix this over the weekend and release an update.
Why is there a check for a fixed maximum anyway? why not put a direct check in there that checks if e.g. a group with number XX exists like api.groups()
might output?
Or simply just return the return code of the Philips API code which might anyway output an error if a certain group/light ID doesn't exist and a query is performed? Just like you can see from here:
$ curl http://192.168.5.28/api/XXXX/groups/20/
[{"error":{"type":3,"address":"/groups/20","description":"resource, /groups/20, not available"}}]
$ curl http://192.168.5.28/api/XXXX/groups/128/
[{"error":{"type":3,"address":"/groups/128","description":"resource, /groups/128, not available"}}]
So, IMHO it should be fairly save to remove the whole group/light check and just return the Philips API result (i.e. "not available").
The fixed maximum, is in their API itself. I don’t expose the direct errors from the API as it used to be limited and misleading on the earlier versions of it. This API library has existed from before there was an official API from Phillips. There are still edge case errors that the bridge does not return a nice of useful message to the user. These checks are also present to represent the limits that Phillips publish in their documentation.
I am finishing off a massive refactoring of this library which is more compatible with the updates from the underlying API as well as removing the now completely unnecessary Q promise library and traits library which reveals the age and origin of this library.
I noticed the following error when using your node-hue-api module:
The code in question causing this error is:
Please note that the
api.groups()
call actually returns a group with id 17:In addition, directly using 17 in e.g.
curl
also correctly outputs information on group 17:To me this looks like a somewhat border-case bug in node-hue-api, isn't it?