Structure

interface Structure : HasId, HasHomeDevices, HasRooms, HasTraits, HasAutomations, HasCandidates, HasSuggestions


The top-level organizing construct for the Home. A Structure allows navigating to all the Rooms and devices (HomeDevice or MatterNode) within that Structure that a caller has permission to access. Each Structure can have a single Google Matter Fabric.

Summary

Public functions

Flow<T>

Gets a Flow that can be used to track changes to a specific Trait.

Public properties

String

User-given name for the Structure.

Extension functions

TypedExpression<TypedEntity<StructureType>>

An extension function of Structure that produces a TypedExpression of structure entity.

suspend Unit

Extension function to delete the history items with the given event type IDs for the structure.

HistoryManager

Extension function to get the history manager for a structure.

HomeBriefsManager

Extension function to get the home briefs manager for a structure.

Inherited functions

From com.google.home.automation.HasAutomations
HomeObjectsFlow<Automation>

List all automations belonging to the structure.

suspend Automation

Create an Automation.

suspend Unit

Delete an Automation.

suspend Unit
deleteAutomation(automationId: Id)

Delete an Automation using an ID.

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.HasHomeDevices
HomeObjectsFlow<HomeDevice>
devices(enableMultipartDevices: Boolean)

Gets an observable flow of HomeDevices visible to the logged-in user, dependent on the context of the implementation (HomeManager, Structure, Room).

From com.google.home.HasRooms
HomeObjectsFlow<Room>

Gets an observable flow of Rooms visible to the logged-in user.

From com.google.home.automation.HasSuggestions
suspend Set<AutomationSuggestion>

Returns all the AutomationSuggestion instances for the receiver.

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.HasId
Id

Opaque ID for the object.

Public functions

trait

@HomeExperimentalApi
fun <T : Trait> trait(trait: TraitFactory<T>): Flow<T>

Gets a Flow that can be used to track changes to a specific Trait. When a value is emitted on this Flow it represents a snapshot of the latest Trait attributes.

For example:

structure.trait(HubManagement)
Parameters
trait: TraitFactory<T>

the Trait to get a flow for.

Returns
Flow<T>

the flow for the specified Trait, otherwise an empty flow if the Trait is not supported by the structure.

Public properties

name

val nameString

User-given name for the Structure. Empty if not assigned.

Extension functions

atExecutionTime

fun Structure.atExecutionTime(): TypedExpression<TypedEntity<StructureType>>

An extension function of Structure that produces a TypedExpression of structure entity.

deleteHistory

@HomeExperimentalApi
suspend fun Structure.deleteHistory(eventTypeIds: List<String>): Unit

Extension function to delete the history items with the given event type IDs for the structure.

getHistoryManager

@HomeExperimentalApi
fun Structure.getHistoryManager(pageSize: Int = 20): HistoryManager

Extension function to get the history manager for a structure.

getHomeBriefsManager

@HomeExperimentalApi
fun Structure.getHomeBriefsManager(): HomeBriefsManager

Extension function to get the home briefs manager for a structure.