# DeviceGroup


```
@HomeExperimentalApi
class DeviceGroup : HomeEntityType, HasCandidates, TraitProvider, PartsProvider
```

<br />

*** ** * ** ***

Domain entity representing a device group in the Home Graph.

## Summary

| ### Nested types |
|---|
| `object https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup.Companion : https://developers.home.google.com/reference/kotlin/com/google/home/EntityTypeFactory` |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#TYPE_ID()` |

| ### Public functions |
|---|---|
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate>>` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#allCandidates()()` Returns all the automation `https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate` instances for the receiver and its child objects. |
| `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate>>` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#candidates()()` Returns all the automation `https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate` instances for the receiver. |
| `open operator https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#equals(kotlin.Any)(other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#hashCode()()` |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#toString()()` |

| ### Public properties |
|---|---|
| `open https://developers.home.google.com/reference/kotlin/com/google/home/EntityTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/HomeEntityType>` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#factory()` The factory associated with this entity type. |
| `open https://developers.home.google.com/reference/kotlin/com/google/home/Id` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#id()` Opaque ID for the object. |
| `open https://developers.home.google.com/reference/kotlin/com/google/home/Id?` | `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#structureId()` Id of the Structure if this group is assigned to one. |

| ### Extension functions |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow<https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice>` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup.https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup#(com.google.home.DeviceGroup).devices(kotlin.Boolean,com.google.home.HomeManager)( enableMultipartDevices: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html, homeManager: https://developers.home.google.com/reference/kotlin/com/google/home/HomeManager )` Returns a flow of `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice`s that belong to this `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup`. |

### Inherited functions

From [com.google.home.PartsProvider](https://developers.home.google.com/reference/kotlin/com/google/home/PartsProvider) `open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<T>` `<T : https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType> https://developers.home.google.com/reference/kotlin/com/google/home/PartsProvider#part(com.google.home.DeviceTypeFactory,kotlin.Array)(type: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<T>, vararg tags: https://developers.home.google.com/reference/kotlin/com/google/home/Tag)`

Gets a flow on the `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType` using the given `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory` and `https://developers.home.google.com/reference/kotlin/com/google/home/Tag`.
`open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<T?>` `<T : https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType> https://developers.home.google.com/reference/kotlin/com/google/home/PartsProvider#partOrNull(com.google.home.DeviceTypeFactory,kotlin.Array)(type: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<T>, vararg tags: https://developers.home.google.com/reference/kotlin/com/google/home/Tag)`

Gets a flow on the `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType` using the given `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory` and `https://developers.home.google.com/reference/kotlin/com/google/home/Tag`.
`open https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>>` `https://developers.home.google.com/reference/kotlin/com/google/home/PartsProvider#parts()()`

Gets a flow on the `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType`s that are parts of this object.
From [com.google.home.TraitProvider](https://developers.home.google.com/reference/kotlin/com/google/home/TraitProvider) `open https://developers.home.google.com/reference/kotlin/com/google/home/Trait.TraitMetadata?` `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/TraitProvider#metadata(com.google.home.TraitFactory)(traitFactory: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)`

Access a specific trait metadata on the provider given a caller-provided TraitFactory.
`open T?` `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/TraitProvider#trait(com.google.home.TraitFactory)(traitFactory: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)`

Access a specific trait on the provider given a caller-provided TraitFactory.
`open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Trait>` `https://developers.home.google.com/reference/kotlin/com/google/home/TraitProvider#traits()()`

Given a similar accessible trait set as the function above, returns a subset of those traits that are present in the associated `https://developers.home.google.com/reference/kotlin/com/google/home/HomeConfig#factoryRegistry()` union'ed with those already known to the extended sub-class (e.g specific DeviceType that is aware of the set of `https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory`s specified in its type definition).

### Inherited properties

From [com.google.home.HasConnectivityState](https://developers.home.google.com/reference/kotlin/com/google/home/HasConnectivityState) `open https://developers.home.google.com/reference/kotlin/com/google/home/SourceConnectivity` `https://developers.home.google.com/reference/kotlin/com/google/home/HasConnectivityState#sourceConnectivity()`

Source Connectivity for the device.

## Constants

### TYPE_ID

```
const val TYPE_ID: String
```

## Public functions

### allCandidates

```
open fun allCandidates(): Flow<Set<NodeCandidate>>
```

Returns all the automation `https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate` instances for the receiver and its child objects.

### candidates

```
open fun candidates(): Flow<Set<NodeCandidate>>
```

Returns all the automation `https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate` instances for the receiver.

### 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 `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow#get(com.google.home.Id)`.

### structureId

```
open 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 `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice`s that belong to this `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceGroup`.

Resolves members reactively by filtering `https://developers.home.google.com/reference/kotlin/com/google/home/HomeManager#devices(kotlin.Boolean)` based on `https://developers.home.google.com/reference/kotlin/com/google/home/google/GroupMembership`.

| Parameters |
|---|---|
| `enableMultipartDevices: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html = false` | Whether to enable the multipart devices. When enabled, the flow emits multipart devices organized in a hierarchy of `https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType`s. When disabled, the flow emits the individual parts of multipart devices as separate `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice`s. |
| `homeManager: https://developers.home.google.com/reference/kotlin/com/google/home/HomeManager = requireNotNull(this.homeManager) { "HomeManager is required to resolve group devices when not provided during hydration" }` | The `https://developers.home.google.com/reference/kotlin/com/google/home/HomeManager` used to query devices. Defaults to the instance provided during hydration. |