Exemplo n.º 1
0
        /// <summary>
        /// Sets the brightness for a group or all RGBW bulbs.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        /// <param name="percentage">The percentage (0-100) of brightness to set.</param>
        public void SetBrightness(int group, int percentage)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new byte[] { BRIGHTNESS, BrightnessToMiLight(percentage), END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Turns down the brightness for the specified group of
        /// white lightbulbs.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public void BrightnessDown(int group)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new [] { BRIGHTDOWN, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Speeds down the current effect for a group or all RGBW bulbs.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public void SpeedDown(int group)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new [] { SPEEDDOWN, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Turns down the temperature of a group of white lights (cooler).
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public void Cooler(int group)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new [] { COOLER, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Sets a given group of RGBW bulbs to the specified color's hue. Does not
        /// support Saturation and Luminosity/Brightness of the color.
        /// For a better representation of the color use <see cref="SetTrueColor"/>.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        /// <param name="color">The <see cref="System.Drawing.Color"/> to set.</param>
        public void SetColor(int group, Color color)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new [] { HUE, HueToMiLight(color.GetHue()), END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Switches the 'disco' mode of a group or all RGBW bulbs.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public void CycleMode(int group)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new [] { MODE, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Sets a given group of RGBW bulbs to the specified hue.
        /// </summary>
        /// <remarks>
        /// MiLight bulbs do not support Saturation and Luminosity/Brightness.
        /// Use <see cref="SetTrueColor"/> for a beter representation of the color.
        /// </remarks>
        /// <param name="group">1-4 or 0 for all groups.</param>
        /// <param name="hue">The hue to set (0 - 360 degrees).</param>
        public void SetHue(int group, float hue)
        {
            CheckGroup(group);             // Check and select
            SelectGroup(group);

            var command = new [] { HUE, HueToMiLight(hue), END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Sets the 'Night' mode for the specified group or all RGBW bulbs.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public void SetNightMode(int group)
        {
            CheckGroup(group);             // Just check

            var command = new byte[] { OFF[group], NIGHT[group], END };

            MiLightGateway.SendCommand(command);

            ActiveGroup = group;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Switches the specified group or all RGBW bulbs to white.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public void SwitchWhite(int group)
        {
            CheckGroup(group);             // Just check

            var command = new [] { WHITE[group], ZERO, END };

            MiLightGateway.SendCommand(command);

            ActiveGroup = group;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Switches 'off' one or all white lightbulbs.
        /// </summary>
        /// <param name="group">1-4 or 0 for all groups.</param>
        public override void SwitchOff(int group)
        {
            CheckGroup(group);             // Just check

            var command = new [] { OFF[group], ZERO, END };

            MiLightGateway.SendCommand(command);

            ActiveGroup = group;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Speeds up the current effect of the RGB bulb(s)/strip(s)
        /// </summary>
        public void SpeedUp()
        {
            var command = new [] { SPEEDUP, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Switches to the next effect of the RGB bulb(s)/strip(s)
        /// </summary>
        public void NextEffect()
        {
            var command = new [] { NEXTEFFECT, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Sets the give hue of the RGB bulb(s)/strip(s)
        /// </summary>
        /// <param name="hue">Hue in 0.0 - 360.0 degrees.</param>
        public void SetHue(float hue)
        {
            var command = new [] { HUE, HueToMiLight(hue), END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Turns down the brightness of the RGB bulb(s)/strip(s)
        /// </summary>
        public void BrightnessDown()
        {
            var command = new [] { BRIGHTDOWN, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Turns up the brightness of the RGB bulb(s)/strip(s)
        /// </summary>
        public void BrightnessUp()
        {
            var command = new [] { BRIGHTUP, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Switches 'off' the RGB bulb(s)/strip(s). Groups are not used in the
        /// context of RGB bulb(s)/strip(s), so this is default set to 0 and does
        /// not have to be specified.
        /// </summary>
        public override void SwitchOff()
        {
            var command = new [] { OFF, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Speeds down the current effect of the RGB bulb(s)/strip(s)
        /// </summary>
        public void SpeedDown()
        {
            var command = new [] { SPEEDDOWN, ZERO, END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Sets the color of the RGB bulb(s)/strips(s). Translates
        /// to hue, no brightness or saturation taken in consideration.
        /// </summary>
        /// <param name="color">The 'System.Drawing.Color' to set.</param>
        public void SetColor(Color color)
        {
            var command = new [] { HUE, HueToMiLight(color.GetHue()), END };

            MiLightGateway.SendCommand(command);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Switches to the previous effect of the RGB bulb(s)/strip(s)
        /// </summary>
        public void PreviousEffect()
        {
            var command = new [] { PREVEFFECT, ZERO, END };

            MiLightGateway.SendCommand(command);
        }