private LightCommand CreateBrightnessCommand(HueBrightness brightness) { var command = new LightCommand(); command.Brightness = brightness.ToValue(); return(command); }
public static byte ToValue(this HueBrightness brightness) { byte brightnessOut; switch (brightness) { case HueBrightness.Minumum: brightnessOut = 0x20; break; case HueBrightness.Low: brightnessOut = 0x40; break; case HueBrightness.Medium: brightnessOut = 0x80; break; case HueBrightness.High: brightnessOut = 0xB0; break; case HueBrightness.Maximum: brightnessOut = 0xFF; break; default: brightnessOut = 0xFF; break; } return(brightnessOut); }
public async Task SetBrightness(HueBrightness brightness, int index) { var command = CreateBrightnessCommand(brightness); SendCommandAsync(command, index); }