示例#1
0
        public Task <Response> SetColorTemperature(uint temperature, uint duration)
        {
            if (temperature < 1700 || temperature > 6500)
            {
                throw new ArgumentException("Temperature must be value from 1700-6500 range");
            }

            var cmd = GenericYeelightCommandFactory.SetColorTemperatureCommand(temperature, duration);

            return(SendRawCommand(cmd));
        }
示例#2
0
        public Task <Response> SetHSVColor(ushort hue, ushort saturation, uint duration)
        {
            if (hue > 360 || saturation > 101)
            {
                throw new ArgumentException("Hue must be lower than 360 and saturation lower than 101");
            }

            var cmd = GenericYeelightCommandFactory.SetHsvColorCommand(hue, saturation, duration);

            return(SendRawCommand(cmd));
        }
示例#3
0
        public Task <Response> SetBrightness(ushort value, uint duration)
        {
            if (value < 1 || value > 100)
            {
                throw new ArgumentException("Brightness must be value from 1-100 range");
            }

            var cmd = GenericYeelightCommandFactory.SetBrightnessCommand(value, duration);

            return(SendRawCommand(cmd));
        }
示例#4
0
        public Task <Response> SetRGBColor(ushort red, ushort green, ushort blue, uint duration)
        {
            if (red > 255 || green > 255 || blue > 255)
            {
                throw new ArgumentException("Each color must be value from 0-255 range");
            }

            var color = red << 16 | green << 8 | blue;

            var cmd = GenericYeelightCommandFactory.SetRgbColorCommand(color, duration);

            return(SendRawCommand(cmd));
        }
示例#5
0
        public Task <Response> SwitchMode(Mode mode, uint duration)
        {
            var cmd = GenericYeelightCommandFactory.SwitchMode(mode, duration);

            return(SendRawCommand(cmd));
        }
示例#6
0
        public Task <Response> TurnOffSmoothly(uint duration)
        {
            var turnOffCmd = GenericYeelightCommandFactory.SwitchState(false, duration);

            return(SendRawCommand(turnOffCmd));
        }
示例#7
0
        public override Task <Response> TurnOff()
        {
            var turnOffCmd = GenericYeelightCommandFactory.SwitchState(false);

            return(SendRawCommand(turnOffCmd));
        }
示例#8
0
        public override Task <Response> SwitchState()
        {
            var toggleCmd = GenericYeelightCommandFactory.ToggleCommand();

            return(SendRawCommand(toggleCmd));
        }