SDM API는 Google Nest 기기 관리를 위해 특성을 확인하고 특성 명령어를 실행하는 다양한 메서드를 제공하는 REST API입니다. 각 API 호출에서 승인 프로세스 중에 부여된 액세스 토큰을 사용합니다.
특성
SDM API는 기기 정보와 기능에 특성 기반 모델을 사용합니다. 개별 기기 가이드를 확인하여 기기에서 사용할 수 있는 특성을 확인하세요.
메서드
SDM API에 사용할 수 있는 모든 메서드에 관한 자세한 내용은 API 참조를 참고하세요.
executeCommand
승인된 기기에 명령어를 실행합니다.
POST 호출을 사용하여 명령어를 실행합니다. 예를 들어 온도 조절기 모드를 변경하려면 다음을 실행합니다.
POST /enterprises/project-id/devices/device-id:executeCommand
{
"command" : "sdm.devices.commands.ThermostatMode.SetMode",
"params" : {
"mode" : "HEAT"
}
}명령어의 추가 예는 각 특성 참조 페이지에서 확인할 수 있습니다. 자세한 내용은 전체 특성 목록을 참고하세요.
get
승인된 구조 또는 기기에 관한 정보를 가져옵니다.
GET 호출은 user 가 승인한 구조 또는 기기에 사용할 수 있는 모든 특성의 현재 필드와 값, 현재 리소스(구조 또는 방)의 상위 리소스를 나타내는 `parentRelations` 객체가 포함된 단일 응답을 반환합니다.
예를 들어 Nest 온도 조절기는 다음을 반환할 수 있습니다.
GET /enterprises/project-id/devices/device-id
{
"name" : "enterprises/project-id/devices/device-id",
"type" : "sdm.devices.types.THERMOSTAT",
"assignee" : "enterprises/project-id/structures/structure-id/rooms/room-id",
"traits" : {
"sdm.devices.traits.Connectivity" : {
"status" : "ONLINE"
},
"sdm.devices.traits.Fan" : {
"timerMode" : "ON",
"timerTimeout" : "2019-05-10T03:22:54Z"
},
"sdm.devices.traits.Humidity" : {
"ambientHumidityPercent" : 35.0
},
"sdm.devices.traits.Info" : {
"customName" : "My device"
},
"sdm.devices.traits.Settings" : {
"temperatureScale" : "CELSIUS"
},
"sdm.devices.traits.Temperature" : {
"ambientTemperatureCelsius" : 23.0
},
"sdm.devices.traits.ThermostatEco" : {
"availableModes" : ["MANUAL_ECO", "OFF"],
"mode" : "MANUAL_ECO",
"heatCelsius" : 20.0,
"coolCelsius" : 22.0
},
"sdm.devices.traits.ThermostatHvac" : {
"status" : "HEATING"
},
"sdm.devices.traits.ThermostatMode" : {
"availableModes" : ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode" : "COOL"
},
"sdm.devices.traits.ThermostatTemperatureSetpoint" : {
"heatCelsius" : 20.0,
"coolCelsius" : 22.0
}
},
"parentRelations" : [
{
"parent" : "enterprises/project-id/structures/structure-id/rooms/room-id",
"displayName" : "Lobby"
}
]
}list
승인된 구조, 방 또는 기기를 나열합니다.
단일 액세스 토큰으로 승인된 모든 구조, 방 또는 기기를 나열하려면 적절한 리소스 엔드포인트에 대해 GET 호출을 실행합니다.
GET /enterprises/project-id/structures
GET /enterprises/project-id/structures/structure-id/rooms
GET /enterprises/project-id/devices
Google 어시스턴트 통합
기기가 SDM에 대해 승인되면 Google은 Home Graph에서 기기를 인식하고 상태를 직접 관리합니다. 상업용 제품의 일부로 Google 어시스턴트 통합이 있는 경우:
오류
전체 API 오류 코드 목록은 API 오류 코드 참조를 확인하세요.