HasTraits

interface HasTraits
Known direct subclasses
HomeDevice

A device supporting traits, commands, and subscriptions.

Structure

The top-level organizing construct for the Home.


An entity with associated traits and trait metadata.

Summary

Public functions

SourceConnectivity?

Gets metadata, such as network locality and connectivity state, about the source of data for a particular trait.

Boolean
Trait> has(trait: TraitFactory)

Checks if a trait is supported by a device.

Public functions

getSourceConnectivity

fun Trait> getSourceConnectivity(trait: TraitFactory): SourceConnectivity?

Gets metadata, such as network locality and connectivity state, about the source of data for a particular trait.

Parameters
trait: TraitFactory

the factory for the trait.

Returns
SourceConnectivity?

the trait's data source metadata, or null if metadata is not available or this object does not have the trait.

has

fun Trait> has(trait: TraitFactory): Boolean

Checks if a trait is supported by a device.

When building the device object, the list of supported traits and types is available during initialization. This list is used to verify support.

For example:

device.has(OnOff)
Parameters
trait: TraitFactory

the Trait to check for.

Returns
Boolean

true if the device supports the Trait, false otherwise.