Table of Contents

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

duration TimeSpan

The time until the light is switched off, in whole minutes (a part of a minute is rounded up), at least one.

cancellationToken CancellationToken

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