Structure

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


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

suspend Set<AutomationSuggestion>
suggestions(sessionId: String, params: SuggestionParams)

Returns all the AutomationSuggestion instances for the receiver, caller can provide optional sessionId for MLP logging.

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.

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>

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

suggestions

suspend fun suggestions(
    sessionId: String = "",
    params: SuggestionParams = SuggestionParams()
): Set<AutomationSuggestion>

Returns all the AutomationSuggestion instances for the receiver, caller can provide optional sessionId for MLP logging.

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.