Home

final class Home
extension Home : Sendable

Top-level entry to the GoogleHomeSDK.

  • Configure App-specific parameters of the GoogleHomeSDK.

    This method should be called before any other Home API method. By default, the configuration is read from the Info.plist.

    Declaration

    Swift

    @MainActor
    static func configure(_ block: (inout HomeClientConfiguration) -> Void)

    Parameters

    block

    The configuration block.

  • Creates a new Home` instance connected to the user’s account.

    Declaration

    Swift

    @MainActor
    static func connect() async throws -> Home

    Return Value

    A Home instance.

  • Restores a previous session and returns a Home instance connected to the user’s account.

    If a session is not found, this method will return nil.

    Declaration

    Swift

    @MainActor
    static func restoreSession() async -> Home?

    Return Value

    A Home instance.

  • Disconnects the Home instance from the user’s account.

    Declaration

    Swift

    func disconnect() async
  • Starts a new commands batch, sends it and asynchronously waits for the response.

    Declaration

    Swift

    @MainActor
    func sendBatchedCommands<T>(_ block: (CommandBatcher) throws -> T) async throws -> T

    Parameters

    block

    A closure that can add commands to the batch and return a result.

    Return Value

    The result of the batch command execution.

  • Presents a view for users to update the permissions granted to the Home SDK.

    If the active user is signed into Safari, the permissions view will be presented for that user. Otherwise, the user will be prompted to select an account or sign in.

    Declaration

    Swift

    @MainActor
    func presentPermissionsUpdate()
  • The version of the SDK; follows the Semantic Versioning 2.0 standard.

    Declaration

    Swift

    static var sdkVersion: String { get }
  • The unique identifier for this Home instance, stable across all sessions.

    Declaration

    Swift

    var identifier: String { get }
  • Query all devices visible to this account.

    Declaration

    Swift

    func devices() -> some Query<HomeDevice>
    
  • Returns a Publisher for a specified device that emits the current state and again on any future state updates.

    Declaration

    Swift

    func device(id: String) -> some Publisher<HomeDevice, HomeError>
    
  • Query all structures visible to this account.

    Declaration

    Swift

    func structures() -> some Query<Structure>
    
  • future state updates.

    Declaration

    Swift

    func structure(id: String) -> some Publisher<Structure, HomeError>
    
  • Query all rooms visible to this account.

    Declaration

    Swift

    func rooms() -> some Query<Room>
    
  • Returns a Publisher for a specified room that emits the current state and again on any future state updates.

    Declaration

    Swift

    func room(id: String) -> some Publisher<Room, HomeError>