Method SetRgbAsync
- Namespace
- Yeelight
- Assembly
- YeelightClient.dll
SetRgbAsync(int, int, int, TimeSpan?, CancellationToken)
Sets the colour.
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 connection.
Returns
- Task
A task that ends when the command has been sent.
Exceptions
- ArgumentOutOfRangeException
An argument is out of the range that the protocol allows.
- YeelightException
The connection is lost.
SetRgbAsync(Color, TimeSpan?, CancellationToken)
Sets the colour.
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 connection.
Returns
- Task
A task that ends when the command has been sent.
Exceptions
- ArgumentOutOfRangeException
The transition is shorter than the light accepts.
- YeelightException
The connection is lost.