OnOffCommands

interface OnOffCommands

Known direct subclasses
OnOff

API for the OnOff trait.


Summary

Public functions

suspend Unit
off()

Turn off the device, and set the onOff attribute to false.

suspend Unit
offWithEffect(
    effectIdentifier: OnOffTrait.EffectIdentifierEnum,
    effectVariant: UByte
)

Allow devices to be turned off using enhanced ways of fading.

suspend Unit
on()

Turn on the device, and set the onOff attribute to true.

suspend Unit

Allow the recall of the settings (global scene) the device had when the device was turned off.

suspend Unit
onWithTimedOff(
    onOffControl: OnOffTrait.OnOffControlBitmap,
    onTime: UShort,
    offWaitTime: UShort
)

Allow the device to be turned on for a specific duration with a guarded off duration so that, should the device be subsequently turned off, further OnWithTimedOff commands received during this time are prevented from turning the devices back on.

suspend Unit

If the device is off, turn the device on and set the onOff attribute to true.

Public functions

off

suspend fun off(): Unit

Turn off the device, and set the onOff attribute to false.

offWithEffect

suspend fun offWithEffect(
    effectIdentifier: OnOffTrait.EffectIdentifierEnum,
    effectVariant: UByte
): Unit

Allow devices to be turned off using enhanced ways of fading.

Parameters
effectIdentifier: OnOffTrait.EffectIdentifierEnum

The fading effect to use when turning the device off. Must be a value from OnOffTrait.EffectIdentifierEnum.

effectVariant: UByte

Variant of the effect, indicated by the effectIdentifier parameter, that is triggered. This must be one of the values in OnOffTrait.DelayedAllOffEffectVariantEnum or OnOffTrait.DyingLightEffectVariantEnum that correspond to the effect specified for effectIdentifier.

on

suspend fun on(): Unit

Turn on the device, and set the onOff attribute to true.

onWithRecallGlobalScene

suspend fun onWithRecallGlobalScene(): Unit

Allow the recall of the settings (global scene) the device had when the device was turned off.

This command is ignored if the globalSceneControl attribute is true.

If the globalSceneControl attribute is false, the global scene is recalled, the onOff attribute is updated accordingly, and the globalSceneControl attribute is set to true.

When this command is called, if the onTime attribute is 0, then the offWaitTime attribute is also set to 0.

onWithTimedOff

suspend fun onWithTimedOff(
    onOffControl: OnOffTrait.OnOffControlBitmap,
    onTime: UShort,
    offWaitTime: UShort
): Unit

Allow the device to be turned on for a specific duration with a guarded off duration so that, should the device be subsequently turned off, further OnWithTimedOff commands received during this time are prevented from turning the devices back on.

Parameters
onOffControl: OnOffTrait.OnOffControlBitmap

When set to 1, the onWithTimedOff command will only be processed if the onOff attribute is true. When set to 0, the onWithTimedOff command is always processed.

onTime: UShort

The duration for which device is turned on. Sets the value of the onTime attribute.

offWaitTime: UShort

The guarded off duration to set for the device. Sets the value of the offWaitTime attribute.

toggle

suspend fun toggle(): Unit

If the device is off, turn the device on and set the onOff attribute to true.

If the device is on, turn the device off and set the onOff attribute to false.