Method SetSleepTimerAsync
- Namespace
- Yeelight
- Assembly
- YeelightClient.dll
SetSleepTimerAsync(TimeSpan, CancellationToken)
Starts a sleep timer: the light is switched off after the time. A device has one timer, and a new one replaces it. Only a light that is on accepts it.
public Task SetSleepTimerAsync(TimeSpan duration, CancellationToken cancellationToken = default)
Parameters
durationTimeSpanThe time until the light is switched off, in whole minutes (a part of a minute is rounded up), at least one.
cancellationTokenCancellationTokenTo stop waiting for the answer.
Returns
- Task
A task that ends when the light has answered.
Exceptions
- ArgumentOutOfRangeException
The duration is shorter than a minute, or longer than the protocol can hold.