-
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
ApiError when trying to setLightState on fresh bridge paired light #197
Comments
This might be due to the light state not being present in the bridge cache... I cannot remember if this is still used in that version (as I have been migrating the code base to TypeScript). If a restart is clearing this out, that would be where I think the problem may be. I would need to set up a test scenario for that as I do not have an easy way to write an automation test for this. |
Yeah, it is the guard that is in place on the cache... node-hue-api/lib/api/Lights.js Line 118 in e51fda5
It will need to be refreshed and is currently done on start up when you connect for the first time, but I thought I might have included some update hooks around this. Clearly if these are being used I have missed your scenario. How is the light being added? Is it done via this library? If so what which API calls are you making? |
Hi Peter, sorry for delay Light is paired with official Philips Hue application then listed via this library, unfortunately the light can't be controlled. Thank you for feedback |
Ok, so that explains it for me 🙇 The library only refreshes the cache on initial connection, or any activity that it performs with respect to pairing a new light (at least it should do as there is code to support the calling of the refresh code). This means that if an external tool/system like the hue application is used to add a new light, the library needs to be prompted to update the cache of the lights that it retrieves upon first connection to the bridge (which is what it does when connecting for the first time). You mention you were using This is a heavy weight call, and will not be needed unless there is external activities that are modifying the lights outside of the library. |
@VonOx does the above details ☝️ explain why this is happening for you and match your use case? Can you issue the resync call via your integration when you need to? |
Hi
I'm contributor to open-source project GladysAssistant
We use this lib in our Philips Hue services ( in version 4.0.9 ). Thank you BTW !
We have some weird behavior, newly bridge paired light can't be controlled without a restart.
See gladys log
Like I said, restarting the app and the problem is gone.
For reference: https://github.com/GladysAssistant/Gladys/blob/master/server/services/philips-hue/lib/light/light.setValue.js
I've no clue about that, what do you think ?
Thank you
The text was updated successfully, but these errors were encountered: