//Toogles aurora on/off public void SetState(bool value) { var nanoLeafModel = new NanoLeafPropertiesModel { On = new NanoLeafValueBooleanModel(value) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); }
/// <summary> /// Select effect to show on aurora /// </summary> /// <param name="effect"></param> public void SetEffect(string effectName) { var nanoLeafModel = new NanoLeafPropertiesModel { Select = new NanoLeafSelectStringModel(effectName) }; SendRequest(_connectionString + "/effects", "PUT", nanoLeafModel.ToString()); }
/// <summary> /// Set brightness value /// </summary> /// <param name="brightnessValue">Accepted value 2-100</param> public void SetBrightness(int brightnessValue) { if (brightnessValue > 1 && brightnessValue <= 100) { var nanoLeafModel = new NanoLeafPropertiesModel { Brightness = new NanoLeafValueIntegerModel(brightnessValue) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); } }
//Set saturation value public void SetSaturation(int saturationValue) { if (saturationValue >= 0 && saturationValue <= 100) { var nanoLeafModel = new NanoLeafPropertiesModel { Saturation = new NanoLeafValueIntegerModel(saturationValue) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); } }
//Set hue value public void SetHue(int hValue) { if (hValue >= 0 && hValue <= 360) { var nanoLeafModel = new NanoLeafPropertiesModel { Hue = new NanoLeafValueIntegerModel(hValue) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); } }
/// <summary> /// Sets colortemperature based on kelvin /// </summary> /// <param name="colorTemperature">Accepted values: 1200-6500</param> public void SetColorTemperature(int colorTemperature) { if (colorTemperature >= 1200 && colorTemperature <= 6500) { var nanoLeafModel = new NanoLeafPropertiesModel { ColorTemperature = new NanoLeafValueIntegerModel(colorTemperature) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); } }
public void SetColor(Color color) { var nanoLeafModel = new NanoLeafPropertiesModel { //Should maybe crate a constructor for color? Saturation = new NanoLeafValueIntegerModel((int)Math.Round(color.GetSaturation() * 100)), Hue = new NanoLeafValueIntegerModel((int)Math.Round(color.GetHue())) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); }
public void SetHueAndSaturation(int hue, int saturation) { if ((saturation >= 0 && saturation <= 100) && (hue >= 0 && hue <= 360)) { var nanoLeafModel = new NanoLeafPropertiesModel { Hue = new NanoLeafValueIntegerModel(hue), Saturation = new NanoLeafValueIntegerModel(saturation) }; SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString()); } }