Table of Contents

Method SendCommandAsync

Namespace
Yeelight
Assembly
YeelightClient.dll

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

Sends any command, for what this class has no method for (the commands of the background light, for one: bg_set_rgb). The method is sent as it is.

public Task 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 connection.

Returns

Task

A task that ends when the command has been sent.

Exceptions

ArgumentException

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

YeelightException

The connection is lost.