HomeDevice

interface HomeDevice : HasId, HasTraits, HasDeviceTypes, HasConnectivityState, HasCandidates


A device supporting traits, commands, and subscriptions.

Summary

Public functions

suspend DecommissionEligibility

Checks if the device is eligible for decommissioning.

suspend Set<Id>

Initiates the decommissioning of this device.

suspend Room?

Gets the up-to-date Room this device is a part of.

suspend HomeDevice
setName(newName: String)

Sets the user-given name of this device.

suspend Structure?

Gets the up-to-date Structure this device is a part of.

Public properties

Boolean

If this device is backed by Matter.

String

The user-given name of this device.

Id?

The ID of the Room this device is a part of.

Id?

The ID of the Structure this device is a part of.

Inherited functions

From com.google.home.automation.HasCandidates
Flow<Set<NodeCandidate>>

Returns all the automation NodeCandidate instances for the receiver and its child objects.

Flow<Set<NodeCandidate>>

Returns all the automation NodeCandidate instances for the receiver.

From com.google.home.HasDeviceTypes
Boolean
<T : DeviceType> has(type: DeviceTypeFactory<T>)

Checks if a device type is supported by this device.

Flow<T>
<T : DeviceType> type(type: DeviceTypeFactory<T>)

Gets a flow on the DeviceType using the given DeviceTypeFactory.

Flow<T?>

Gets a flow on the DeviceType using the given DeviceTypeFactory.

Flow<Set<DeviceType>>

Gets a list of all available types on the HomeDevice.

From com.google.home.HasTraits
SourceConnectivity?

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

Boolean
<T : Trait> has(trait: TraitFactory<T>)

Checks if a trait is supported by a device.

Inherited properties

From com.google.home.HasConnectivityState
SourceConnectivity

Source Connectivity for the device.

From com.google.home.HasId
Id

Opaque ID for the object.

Public functions

checkDecommissionEligibility

suspend fun checkDecommissionEligibility(): DecommissionEligibility

Checks if the device is eligible for decommissioning.

Returns
DecommissionEligibility

a data class representing the device's eligibility for decommissioning.

decommissionDevice

suspend fun decommissionDevice(): Set<Id>

Initiates the decommissioning of this device. Throws an exception if the device is not eligible for decommissioning.

Returns
Set<Id>

the set of device IDs that were affected by the decommissioning of this device.

room

suspend fun room(): Room?

Gets the up-to-date Room this device is a part of.

Returns
Room?

the Room this device is a part of, or null if the device is not in a Room.

setName

suspend fun setName(newName: String): HomeDevice

Sets the user-given name of this device.

Parameters
newName: String

the new name for this device.

Returns
HomeDevice

an updated HomeDevice, with the new name, or previous name if the update failed.

Throws
com.google.home.HomeException

if the update failed.

CancellationException

if the update is cancelled.

structure

suspend fun structure(): Structure?

Gets the up-to-date Structure this device is a part of.

Returns
Structure?

the Structure this device is a part of, or null if the device is not in a Structure.

Public properties

isMatterDevice

val isMatterDeviceBoolean

If this device is backed by Matter.

name

val nameString

The user-given name of this device.

roomId

val roomIdId?

The ID of the Room this device is a part of. Null if the device is not in a Room.

structureId

val structureIdId?

The ID of the Structure this device is a part of. Null if the device is not in a Structure.