示例#1
0
        //Toogles aurora on/off
        public void SetState(bool value)
        {
            var nanoLeafModel = new NanoLeafPropertiesModel {
                On = new NanoLeafValueBooleanModel(value)
            };

            SendRequest(_connectionString + "/state", "PUT", nanoLeafModel.ToString());
        }
示例#2
0
        /// <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());
        }
示例#3
0
 /// <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());
     }
 }
示例#4
0
 //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());
     }
 }
示例#5
0
 //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());
     }
 }
示例#6
0
 /// <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());
     }
 }
示例#7
0
        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());
        }
示例#8
0
 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());
     }
 }