Table of Contents

Method SetPowerAsync

Namespace
Yeelight
Assembly
YeelightClient.dll

SetPowerAsync(bool, TimeSpan?, PowerOnMode, CancellationToken)

Switches the light on or off.

public Task SetPowerAsync(bool on, TimeSpan? transition = null, PowerOnMode mode = PowerOnMode.Normal, CancellationToken cancellationToken = default)

Parameters

on bool

true to switch on, false to switch off.

transition TimeSpan?

How long the change takes, or null for a sudden one.

mode PowerOnMode

The mode to switch on in (only when switching on).

cancellationToken CancellationToken

To stop waiting for the answer.

Returns

Task

A task that ends when the light has answered.

Exceptions

ArgumentOutOfRangeException

The transition is shorter than the light accepts.

ArgumentException

A mode other than Normal is given when switching off.