Method SetRgbAsync
- Namespace
- Yeelight
- Assembly
- YeelightClient.dll
SetRgbAsync(int, int, int, TimeSpan?, CancellationToken)
Sets the colour, which switches the light to Rgb. Only a light that is on accepts it.
public Task SetRgbAsync(int red, int green, int blue, TimeSpan? transition = null, CancellationToken cancellationToken = default)
Parameters
redintThe red part of the colour, 0 to 255.
greenintThe green part of the colour, 0 to 255.
blueintThe blue part of the colour, 0 to 255.
transitionTimeSpan?How long the change takes, or
nullfor a sudden one.cancellationTokenCancellationTokenTo stop waiting for the answer.
Returns
- Task
A task that ends when the light has answered.
Exceptions
- ArgumentOutOfRangeException
An argument is out of the range that the protocol allows.
SetRgbAsync(Color, TimeSpan?, CancellationToken)
Sets the colour, which switches the light to Rgb. Only a light that is on accepts it.
public Task SetRgbAsync(Color color, TimeSpan? transition = null, CancellationToken cancellationToken = default)
Parameters
colorColorThe colour. Its alpha is ignored.
transitionTimeSpan?How long the change takes, or
nullfor a sudden one.cancellationTokenCancellationTokenTo stop waiting for the answer.
Returns
- Task
A task that ends when the light has answered.
Exceptions
- ArgumentOutOfRangeException
The transition is shorter than the light accepts.