Table of Contents

Method SetPowerAsync

Namespace
Yeelight
Assembly
YeelightClient.dll

SetPowerAsync(bool, TimeSpan?, CancellationToken)

Switches the light on or off.

public Task SetPowerAsync(bool on, TimeSpan? transition = null, 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.

cancellationToken CancellationToken

To stop waiting for the connection.

Returns

Task

A task that ends when the command has been sent.

Exceptions

ArgumentOutOfRangeException

The transition is shorter than the light accepts.

YeelightException

The connection is lost.