Support for scenes
It would be nice if it were possible to list scenes and enable them using this library. I want to make a small interface to operate my home lights, and I want to be able to enable scenes with it.
I'm not doing new features myself for this library at this point, but I will review and merge PR for scenes support.
Alright! I think I can come up with a PR to rework some of the internals and add support for groups one of these days. I'd also like to add some tests here and there to make sure I don't break anything. One thing I'd like to look into is splitting the Bridge into two structs: UnauthBridge and Bridge, so that it is a compile error to try to run API calls without providing a password or logging in by making the invalid calls simply not exist. Would such a PR be welcome?
All of this sounds pretty good. One single thing: I prefer, when practical, to have separate PRs for distinct things. At least keep the bridge state refactoring separate from new features.
Alright, I'll try to make a couple of smaller PR's, but I might have to wait until they get accepted, or fork off them to create the next PR then.
I'll try my best to be very reactive.
Seems great so far :smiley:
I went through some online docs I found and I implemented the "config", "group" and "schedule" API's, but I can't seem to find docs pertaining to scenes. Did you ever stumble on something along these lines?
Now that you mention this, I wonder if scenes are not just a client side thing...
I don't think that that is true. If i create a scene on one device, I can see and activate that scene from another device as well.
I'm implementing support for schedules currently, and since the documentation is a bit lacking I am looking at the JSON for schedules and I noticed this command performed my one of my default schedules:
"command":{
"address":"/api/<UUID>/groups/0/action",
"body":{"scene":"BS8gROMPGsehOqT"},
"method":"PUT"
}
So it seems like it is possible to send the desired scene to /groups/id/action. According to the docs, this endpoint expects a CommandLight, so maybe those can be interchanged.
aha, interesting :)
googling...
https://stackoverflow.com/questions/18274632/how-to-create-scenes-with-the-philips-hue-api https://github.com/peter-murray/node-hue-api/blob/master/examples/v3/scenes/updateSceneLightState.js#L57
One thing I'd like to look into is splitting the
Bridgeinto two structs:UnauthBridgeandBridge, so that it is a compile error to try to run API calls without providing a password or logging in by making the invalid calls simply not exist.
This is a great idea. I love how Rust's ownership model lets you enforce concepts like this.