iOS용 앱 관리 자동화

앱 관리 자동화는 파트너 앱이 Automation API를 사용하여 프로그래매틱 방식으로 구성한 자동화입니다.

이러한 자동화는 Google Home app (GHA) 자동화 목록에 표시되지 않습니다.

앱 관리 자동화가 트리거될 때 Home API 활동 피드에 기록되는 정보는 맞춤설정하거나 완전히 억제할 수 있습니다. 예를 들어 파트너가 앱 관리 자동화를 사용하여 구현된 'Arctic'이라는 브랜드 서비스를 제공하는 경우 파트너는 앱 관리 자동화가 실행될 때 실제 자동화 이름 대신 활동 피드에서 Arctic 서비스가 참조되도록 지정할 수 있습니다.

앱 관리 자동화 만들기

앱 관리 자동화를 만들려면 다음 절차를 따르세요.

  1. 자동화의 로직 그래프를 빌드합니다.

  2. 선택사항 자동화 활동을 활동 피드에 표시하려면 자동화 이름 대신 피드에 표시할 현지화된 메시지로 AppManagedAutomationConfig 인스턴스를 채우면 됩니다. 앱 또는 서비스의 현지화된 이름이나 원하는 다른 메시지일 수 있습니다. 현지화된 문자열을 제공하지 않으면 자동화 실행이 다른 자동화와 마찬가지로 로깅됩니다. 최상의 사용자 환경을 위해 이러한 현지화된 문자열을 설정하는 것이 좋습니다.

    let automationConfig = AppManagedAutomationConfig(
        managingAppDisplayNames: [
          LocalizedText(text: "My Custom SmartApp", locale: "en-US"),
          LocalizedText(text: "Mi aplicación personalizada", locale: "es-MX")
        ]
    )
    
  3. Automation.Builder를 사용하여 자동화 인스턴스를 만듭니다.

    1. 자동화의 name을 설정합니다.
    2. 자동화 실행 기록이 GHA의 활동 탭에 표시되도록 하려면 client_feature_group"APP_MANAGED_EXECUTION_REPORTED"로 설정하고, 자동화 실행 기록이 표시되지 않도록 하려면 "APP_MANAGED_EXECUTION_UNREPORTED"로 설정합니다.
    3. automationGraph을 설정합니다.
    4. 선택사항 자동화의 appManagedAutomationConfig를 설정합니다 (2단계 참고).
  4. 마지막으로 build()를 호출하여 Automation 인스턴스를 빌드합니다.

다음은 전체 절차를 보여주는 예입니다.


import GoogleHomeSDK
import GoogleHomeTypes

let devices = try await home.devices().list()
let mySensor: HomeDevice = devices.first(where: {
    $0.types.contains(OccupancySensorDeviceType.self) &&
    $0.structureID == structure.id
})

let myLight: HomeDevice = devices.first(
  where: {
    $0.types.contains(OnOffLightDeviceType.self) &&
    $0.structureID == structure.id
  }
)

// 1. Create logic graph
let starterNode = StarterNode(
    device: mySensor,
    trait: Matter.OccupancySensingTrait.self
)

let actionNode = ActionNode(
    device: myLight,
    command: Matter.OnOffTrait.on()
)

// Bundle nodes into a sequential graph
let automationGraph = SequentialFlow(
    nodes: [starterNode, actionNode]
)

// 2. Build the AppManagedAutomationConfig with the localized app names
let automationConfig = AppManagedAutomationConfig(
    managingAppDisplayNames: [
      LocalizedText(text: "My Custom SmartApp", locale: "en-US"),
      LocalizedText(text: "Mi aplicación personalizada", locale: "es-MX")
    ]
)

// 3. Build the Automation with both configuration and the graph
let myFunctionalAutomation = try AutomationBuilder()
    .setName("Motion Activated Light")                         // a. Set the name
    .setClientFeatureGroup("APP_MANAGED_EXECUTION_UNREPORTED") // b. set the clientFeatureGroup
    .setAutomationGraph(automationGraph)                       // c. Attach the logic graph
    .setAppManagedAutomationConfig(automationConfig)           // d. Set the automationConfig
    .build() // 4. build the automation