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
methodstringThe method, as the protocol names it.
parametersIReadOnlyList<object>The parameters: numbers, text and truth values.
cancellationTokenCancellationTokenTo 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
methodis empty, or a parameter is not a number, text or a truth value.- OperationCanceledException
The wait was cancelled.