OnOff

interface OnOff : OnOffTrait.Attributes, MatterTrait, Updatable, OnOffCommands


API for the OnOff trait. This trait provides an interface for turning devices on and off.

Summary

Nested types

Descriptor enum for this trait's attributes.

Descriptor enum for this trait's commands.

Public functions

Boolean
Boolean

Public properties

open TraitFactory<OnOff>

Inherited functions

From com.google.home.matter.standard.OnOffCommands
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.

From com.google.home.TraitStateInvalidation
suspend Unit
From com.google.home.Updatable
suspend OnOff
update(optimisticReturn: (OnOff) -> Unit, init: OnOffTrait.MutableAttributes.() -> Unit)

Creates a mutable copy of an object and calls the given function to mutate it, then saves it and returns a new immutable copy with the updated state.

Inherited properties

From com.google.home.matter.standard.OnOffTrait.Attributes
List<UInt>

A list of client-generated commands which are supported by this cluster server instance.

List<UInt>

A list of the attribute IDs of the attributes supported by the cluster instance.

UShort

The revision of the server cluster specification supported by the cluster instance.

OnOffTrait.Feature

Whether the server supports zero or more optional cluster features.

List<UInt>

A list of server-generated commands (server to client) which are supported by this cluster server instance.

Boolean?

When set to true, prevents the global scene from being destroyed by subsequent off or on commands.

UShort?

The length of time (in 0.1 seconds) that the onOff attribute is false before allowing another OnWithTimedOff command to turn the device back on.

Boolean?

Whether the device type implemented on the endpoint is turned off (false) or turned on (true).

UShort?

The length of time (in 0.1 seconds) that the onOff attribute is true before changing to false when using the OnWithTimedOff command.

OnOffTrait.StartUpOnOffEnum?

The desired startup behavior of a device when supplied with power.

From com.google.home.Trait

Public functions

supports

fun supports(attribute: OnOff.Attribute): Boolean

supports

fun supports(command: OnOff.Command): Boolean

Public properties

factory

open val factoryTraitFactory<OnOff>