앱 관리 자동화는 파트너 앱이 Automation API를 사용하여 프로그래매틱 방식으로 구성한 자동화입니다.
이러한 자동화는 Google Home app (GHA) 자동화 목록에 표시되지 않습니다.
앱 관리 자동화가 트리거될 때 Home API 활동 피드에 기록되는 정보는 맞춤설정하거나 완전히 억제할 수 있습니다. 예를 들어 파트너가 앱 관리 자동화를 사용하여 구현된 'Arctic'이라는 브랜드 서비스를 제공하는 경우 파트너는 앱 관리 자동화가 실행될 때 실제 자동화 이름 대신 활동 피드에서 Arctic 서비스가 참조되도록 지정할 수 있습니다.
앱 관리 자동화 만들기
앱 관리 자동화를 만들려면 다음 절차를 따르세요.
자동화의 로직 그래프를 빌드합니다.
선택사항 자동화 활동을 활동 피드에 표시하려면 자동화 이름 대신 피드에 표시할 현지화된 메시지로
AppManagedAutomationConfig인스턴스를 채우면 됩니다. 앱 또는 서비스의 현지화된 이름이나 원하는 다른 메시지일 수 있습니다. 현지화된 문자열을 제공하지 않으면 자동화 실행이 다른 자동화와 마찬가지로 로깅됩니다. 최상의 사용자 환경을 위해 이러한 현지화된 문자열을 설정하는 것이 좋습니다.val myAutomationConfig = AppManagedAutomationConfig( managingAppDisplayNames = listOf( LocalizedText(text = "My custom SmartApp", locale = "en-US"), LocalizedText(text = "Mi aplicación personalizada", locale = "es-MX") ) )Automation.Builder를 사용하여 자동화 인스턴스를 만듭니다.- 자동화의
name을 설정합니다. - 자동화 실행 기록이 GHA의 활동 탭에 표시되도록 하려면
client_feature_group을"APP_MANAGED_EXECUTION_REPORTED"로 설정하고, 자동화 실행 기록이 표시되지 않도록 하려면"APP_MANAGED_EXECUTION_UNREPORTED"로 설정합니다. automationGraph을 설정합니다.- 선택사항 자동화의
appManagedAutomationConfig를 설정합니다 (2단계 참고).
- 자동화의
마지막으로
build()를 호출하여Automation인스턴스를 빌드합니다.
다음은 전체 절차를 보여주는 예입니다.
import com.google.home.automation.Automation
import com.google.home.automation.SequentialNode
import com.google.home.automation.StarterNode
import com.google.home.automation.ActionNode
import com.google.home.HomeDevice
import com.google.home.matter.standard.OnOff
import com.google.home.matter.standard.OnOffLightDevice
import com.google.home.matter.standard.MotionDetection
import com.google.home.matter.standard.OccupancySensorDevice
HomeDevice mySensor = home.devices().list().first { device -> device.has(OccupancySensorDevice) }
HomeDevice myLight = home.devices().list().first { device -> device.has(OnOffLightDevice) }
// 1. Create logic graph
val starterNode = StarterNode(
device = mySensor,
trait = OccupancySensing
)
val actionNode = ActionNode(
device = myLight,
command = OnOff.on()
)
// Bundle nodes into a sequential graph
val automationGraph = SequentialNode(
nodes = listOf(starterNode, actionNode)
)
// 2. Build the AppManagedAutomationConfig with the localized app names
val AppManagedAutomationConfig myAutomationConfig = 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
val myAutomation = Automation.Builder()
.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(myCustomConfig) // d. Set the automationConfig
.build() // 4. build the automation