Closed jeroenbeuz closed 6 years ago
In order to get that information you have to explicitly call fetch() on the scene. Light states are not part of the full config or /api/
I finally got this to work. Yes a fetch is required to get the full state of the scene. But the current way I fetch them makes no sense, so I hope theres a better way.
In the callback you have no idea for which particular scene the callback fires. This does not make sense. I would expect this behavior for a method that fetches ALL scenes from the bridge. For fetching a single scene I would expect that scene to be available in the callback. Also, I would expect a fetchScenes to be available on the bridge. Now I first have to get the list of scenes on the bridge, fetch one of them, and then get the scenes with state in the callback.
The callback fires only for the scene were fetched is called on. It would be better to update the object itself where called fetch() on, so you don't need to get the fetched scene from the bridge state again. This improvement is on our backlog, but not planned for a release yet.
Scenes from the bridge state never have lights with a state. I noticed that every scene has the property storeLightstate on null. So I updated every scene to have storeLightstate on 'true', in the hope the lightstates would be saved so I can retrieve them. No luck. Also tried getting the scenes individually, like we had to in the PHHueSDK. Also no luck.
This is my code:
So how do I retrieve the lightstates of a scene from the bridge?