DeviceGroup

@HomeExperimentalApi
class DeviceGroup : HomeEntityType, TraitProvider


Domain entity representing a device group in the Home Graph.

Summary

Constants

const String

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

open EntityTypeFactory<HomeEntityType>

The factory associated with this entity type.

open Id

Opaque ID for the object.

Id?

Id of the Structure if this group is assigned to one.

Extension functions

HomeObjectsFlow<HomeDevice>
@HomeExperimentalApi
DeviceGroup.devices(
    enableMultipartDevices: Boolean,
    homeManager: HomeManager
)

Returns a flow of HomeDevices that belong to this DeviceGroup.

Inherited functions

From com.google.home.TraitProvider
open Trait.TraitMetadata?
<T : Trait> metadata(traitFactory: TraitFactory<T>)

Access a specific trait metadata on the provider given a caller-provided TraitFactory.

open T?
<T : Trait> trait(traitFactory: TraitFactory<T>)

Access a specific trait on the provider given a caller-provided TraitFactory.

open Set<Trait>

Given a similar accessible trait set as the function above, returns a subset of those traits that are present in the associated HomeConfig.factoryRegistry union'ed with those already known to the extended sub-class (e.g specific DeviceType that is aware of the set of TraitFactorys specified in its type definition).

Constants

TYPE_ID

const val TYPE_ID: String

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

factory

open val factory: EntityTypeFactory<HomeEntityType>

The factory associated with this entity type.

id

open val id: Id

Opaque ID for the object. Used for comparison and HomeObjectsFlow.get.

structureId

val structureId: Id?

Id of the Structure if this group is assigned to one.

Extension functions

devices

@HomeExperimentalApi
fun DeviceGroup.devices(
    enableMultipartDevices: Boolean = false,
    homeManager: HomeManager = requireNotNull(this.homeManager) { "HomeManager is required to resolve group devices when not provided during hydration" }
): HomeObjectsFlow<HomeDevice>

Returns a flow of HomeDevices that belong to this DeviceGroup.

Resolves members reactively by filtering HomeManager.devices based on GroupMembership.

Parameters
enableMultipartDevices: Boolean = false

Whether to enable the multipart devices. When enabled, the flow emits multipart devices organized in a hierarchy of DeviceTypes. When disabled, the flow emits the individual parts of multipart devices as separate HomeDevices.

homeManager: HomeManager = requireNotNull(this.homeManager) { "HomeManager is required to resolve group devices when not provided during hydration" }

The HomeManager used to query devices. Defaults to the instance provided during hydration.