Table of Contents

Method SendCommandAsync

Namespace
Yeelight
Assembly
YeelightClient.dll

SendCommandAsync(string, IReadOnlyList<object?>?, CancellationToken)

Sends a command by its method and parameters, as the protocol has them ("set_power" with "on", "smooth", 500), for what this class has no method for. Nothing is added to the method and nothing is checked.

public Task<YeelightResult> SendCommandAsync(string method, IReadOnlyList<object?>? parameters = null, CancellationToken cancellationToken = default)

Parameters

method string

The method, as the protocol names it.

parameters IReadOnlyList<object>

The parameters: numbers, text and truth values.

cancellationToken CancellationToken

To stop waiting for the answer.

Returns

Task<YeelightResult>

The answer of the light. This does not throw for a command that did not succeed: look at Success.

Exceptions

ArgumentException

method is empty, or a parameter is not a number, text or a truth value.

OperationCanceledException

The wait was cancelled.