Table of Contents

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

red int

The red part of the colour, 0 to 255.

green int

The green part of the colour, 0 to 255.

blue int

The blue part of the colour, 0 to 255.

transition TimeSpan?

How long the change takes, or null for a sudden one.

cancellationToken CancellationToken

To 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

color Color

The colour. Its alpha is ignored.

transition TimeSpan?

How long the change takes, or null for a sudden one.

cancellationToken CancellationToken

To 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.