Closed AleRoe closed 1 year ago
Small addition: By updating the class UpdateGroupedLight to implement the two new interfaces, the extensions should then also work.
Thanks for the contribution. I added the code to the project and it's released with version 0.10.0.
Next time, you can fork this project, then make the changes on your own fork and create a PR to this project.
Hi Michiel, thanks for adding the code, much appreciated! Just tested with the new version and works as expected.
I did notice a small error in my code though :
Dimming.Brightness is of type double.
The method signature for public static T SetBrightness<T>(this T lightCommand, int brightness) where T : IUpdateDimming
mistakenly takes an int for the brightness parameter. While this does not break, it might be worth fixing at some time. No need for an immediate fix. Sorry for the inconvenience!
I will definitely give forking a try for further enhancements!
Closing this issue as resolved. Kind regards, Alexander
I'll change it to a double
in the next version.
I'm also going to change DimmingDelta.BrightnessDelta
from an integer to a double. In the Hue Api documentation these fields are indicated as number
instead of integer
. So i will also change the SetBrightnessDelta
extension method.
Hi Michael,
I took the liberty to extend the UpdateLightExtensions with two new static methods:
public static T SetBrightnessDelta<T>(this T lightCommand, DeltaAction action, int brightnessDelta) where T : IUpdateDimmingDelta
public static T SetBrightness<T>(this T lightCommand, int brightness) where T : IUpdateDimming
As I can't create a new branch / pull request, please see code below. Would be great if you could incorporate this in the next release.
Add new interfaces:
Have UpdateLight() implement new interfaces:
Add to UpdateLightExtensions.cs:
Add Unittests to LightTests.cs:
Kind regards Alexander