PartsProvider

@HomeExperimentalApi
interface PartsProvider : HasConnectivityState

Known direct subclasses
DeviceGroup

Domain entity representing a device group in the Home Graph.

EmptyPartsProvider

A PartsProvider for objects that expose no parts.

HasDeviceTypes

This interface allows for getting device types from a Device.

HomeEntityType

Common base interface for all first-class hydrated entities in the Home Graph.

Known indirect subclasses
DeviceGroup

Domain entity representing a device group in the Home Graph.

HomeDevice

A device supporting traits, commands, and subscriptions.


Interface for objects that expose a reactive flow of parts, such as HomeDevice and HomeEntityType.

Implementations that back a hydrated entity must provide value-based equals and hashCode; entity equality folds the provider in.

Summary

Public functions

Flow<T>
<T : DeviceType> part(type: DeviceTypeFactory<T>, vararg tags: Tag)

Gets a flow on the DeviceType using the given DeviceTypeFactory and Tag.

Flow<T?>
<T : DeviceType> partOrNull(type: DeviceTypeFactory<T>, vararg tags: Tag)

Gets a flow on the DeviceType using the given DeviceTypeFactory and Tag.

Flow<Set<DeviceType>>

Gets a flow on the DeviceTypes that are parts of this object.

Inherited properties

From com.google.home.HasConnectivityState
SourceConnectivity

Source Connectivity for the device.

Public functions

part

fun <T : DeviceType> part(type: DeviceTypeFactory<T>, vararg tags: Tag): Flow<T>

Gets a flow on the DeviceType using the given DeviceTypeFactory and Tag.

Parameters
type: DeviceTypeFactory<T>

the device type to get.

vararg tags: Tag

The tags to filter by.

Returns
Flow<T>

a flow that can be used to track changes to a specific type. If the type is not supported, an empty flow is returned. When multiple instances match, whether the first match or nothing is emitted depends on the implementation; pass tags to disambiguate.

partOrNull

fun <T : DeviceType> partOrNull(type: DeviceTypeFactory<T>, vararg tags: Tag): Flow<T?>

Gets a flow on the DeviceType using the given DeviceTypeFactory and Tag.

Parameters
type: DeviceTypeFactory<T>

the device type to get.

vararg tags: Tag

The tags to filter by.

Returns
Flow<T?>

a flow that can be used to track changes to a specific type. If the type is not supported, null is emitted. When multiple instances match, whether the first match or null is emitted depends on the implementation; pass tags to disambiguate.

parts

fun parts(): Flow<Set<DeviceType>>

Gets a flow on the DeviceTypes that are parts of this object.

Returns
Flow<Set<DeviceType>>

a flow that can be used to track changes to the parts of this object.