-
Notifications
You must be signed in to change notification settings - Fork 145
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
Error fetching scenes since upgrading to v4 #165
Comments
There are multiple scene types in the hue bridge;
The I would suspect that we may have a case of your bridge containing a You can turn on debug for the requests for the library and it will dump out the data it is requesting and getting back from the bridge, which should reveal the payload coming back from the bridge that is failing to get processed here. If you post that request I can look over it. If you do post anything from the debug, be aware of the fact your API key is exposed in the output, do redact that first. |
Thanks for the response, will take a look when I get a chance. I didn't realise I could get debug the requests to the bridge, that's a pretty useful feature! I suspect then I've probably sent some dodgy data to the bridge which has created a scene with no lights or something, so hopefully if I can identify that, then I can delete it using its ID. Will update when I've had a look. Cheers |
That did the trick. There wasn't anything obvious in the debug log but running the GET query api/{apiKey}/scenes returned a bunch of JSON. Looking through that JSON I could see two scenes of type 'LightScene' with no lights in the array. They both had the name 'Wake Up Init' and neither had been updated since 2017. I'm assuming they must have been created by some third party android app but not sure. I used node-hue-api to delete the two offending scenes and the node-hue-api scenes getAll() api call started working again! I'm guessing the previous version must not have failed when the light array was empty since I only started experiencing the issue after upgrading from v3 to v4 so might be worth validating the checks that are in place. Thanks for your help and appreciate all the work you've put into this library. |
The 4.x versions of the library adopted the type system that I was using in the http calls to the bridge object model, this means I can validate data earlier, rather than submitting it to the bridge and hope it comes back with a meaningful error message (usually not), or have to put in multiple checks for type/payload validation all over the place. According to the models and restrictions are based on the documentation provided by Signify for the api, but as you have noted, these were from a long time back, where those restrictions were not necessarily in place. The model object you get back from the library are the same ones you create in code to build these objects on the bridge, so I cannot relax these requirements, otherwise when you miss a value you will get a cryptic message back about invalid payload from the hue bridge. The only thing I could think of with respect to validating you’re complete internal data state on an existing bridge would be to load every object (lights, groups, scenes, sensors, resource links, etc...) and then catch the errors indicating an invalid object. Whilst it could be useful, it would still require an end user to clean up the data objects. I think the error you provided should be improved to better report the field on the object that failed, which would make resolving issues a little easier. |
I just came across this (still happens in the v5 beta), and I'm pretty sure I found the root cause - this happens when fetching scenes, when there's a room that has no scenes, which is a valid case - at least the iOS app manages to function like that (and create that situation). |
Removing rooms with no lights (and thus no scenes) fixed it for me |
When calling api.scenes.getAll() on version 4.0.4 (have also tested downgrading to all other v4 versions) I get the following error message:
I thought that it could mean there aren't any scenes available but on v3 everything was working perfectly. Any suggestions?
Cheers
Jack
The text was updated successfully, but these errors were encountered: