性狀
SDM API 中的特徵 包含欄位 、指令 和事件 。
所有對 SDM API 的呼叫都應使用以下端點:https://smartdevicemanagement.googleapis.com/v1
欄位
欄位是具有常見資料類型的值,例如數字或字串。舉例來說,欄位可能包含 Google Nest Thermostat 的目前模式或環境濕度。
您可以透過 GET
呼叫所需 API 端點,查看特徵和欄位:
GET /enterprises/project-id /devices/device-id
{
"name" : "enterprises/project-id /devices/device-id ",
"type" : "sdm.devices.types.device-type ",
"traits" : { ... },
"parentRelations" : [
{
"parent" : "enterprises/project-id /structures/structure-id /rooms/room-id ",
"displayName" : "Lobby"
}
]
}
裝置類型
SDM API 傳回的 sdm.devices.types.device-type
不應用於推論或推斷其所指派的實際裝置功能。隨著 SDM API 新增更多功能,我們無法保證裝置類型在特定裝置上會維持穩定。請改用裝置傳回的特徵。
parentRelations
parentRelations
物件代表目前資源的父項資源,可能是結構體或房間。顯示名稱會對應到欄位 (適用於有結構體上層裝置的裝置),或是欄位 (適用於有房間上層裝置的裝置)。
指令
指令是與特徵相關聯的要求。例如,變更 Google Nest 溫度控制器的目前模式或溫度設定點。
透過 executeCommand
API 呼叫傳送指令:
POST /enterprises/project-id /devices/device-id :executeCommand
{
"command" : "command-name ",
"params" : {
"field " : "value "
}
}
大多數指令的回應都是簡單的成功或失敗。如需特定指令的使用範例,請參閱個別特徵指南。
活動
事件為非同步資料,由 Google Cloud Pub/Sub 管理,每個 Project ID 會在單一主題中管理。
根據預設,系統會在特徵欄位的值有任何變更時傳送事件。也可以在回應特定裝置動作或資源指派變更時傳送。詳情請參閱「事件 」一文。
特徵類別
結構
特徵
資訊
sdm.structures.traits.Info
這個特徵屬於任何結構的結構相關資訊。
RoomInfo
sdm.structures.traits.RoomInfo
這個特徵屬於任何房間,可用於提供房間相關資訊。
裝置
特徵
連線能力
sdm.devices.traits.Connectivity
這個特徵屬於任何具有連線資訊的裝置。
Fan
sdm.devices.traits.Fan
這個特徵屬於任何具有系統控制風扇功能的裝置。
濕度
sdm.devices.traits.Humidity
此特徵屬於任何具有用於測量濕度感應器的裝置。
資訊
sdm.devices.traits.Info
這個特徵屬於任何裝置,可用於提供裝置相關資訊。
設定
sdm.devices.traits.Settings
這個特徵屬於任何裝置,可提供裝置相關設定資訊。
溫度
sdm.devices.traits.Temperature
這個特徵屬於任何具有溫度感應器的裝置。
溫度控制器
特徵
ThermostatEco
sdm.devices.traits.ThermostatEco
這個特徵屬於支援 ECO 模式的溫度控制器裝置類型。
ThermostatHvac
sdm.devices.traits.ThermostatHvac
這個特徵屬於可回報 HVAC 詳細資料的溫度控制器裝置類型。
ThermostatMode
sdm.devices.traits.ThermostatMode
這個特徵屬於支援不同溫度控制器模式的 THERMOSTAT 裝置類型。
ThermostatTemperatureSetpoint
sdm.devices.traits.ThermostatTemperatureSetpoint
這個特徵屬於支援設定目標溫度和溫度範圍的溫度控制器裝置類型。
相機
特徵
CameraClipPreview
sdm.devices.traits.CameraClipPreview
這個特徵屬於任何支援下載短片預覽的裝置。
CameraEventImage
sdm.devices.traits.CameraEventImage
這個特徵屬於任何支援從事件產生圖片的裝置。
CameraImage
sdm.devices.traits.CameraImage
這個特徵屬於任何支援拍照的裝置。
CameraLiveStream
sdm.devices.traits.CameraLiveStream
這項特徵屬於任何支援直播的裝置。
CameraMotion
sdm.devices.traits.CameraMotion
這個特徵屬於任何支援動作偵測事件的裝置。
CameraPerson
sdm.devices.traits.CameraPerson
這個特徵屬於任何支援人物偵測事件的裝置。
CameraSound
sdm.devices.traits.CameraSound
這個特徵屬於任何支援聲響偵測事件的裝置。
門鈴
特徵
DoorbellChime
sdm.devices.traits.DoorbellChime
這個特徵屬於任何支援門鈴鈴聲和相關按下事件的裝置。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-25 (世界標準時間)。
[null,null,["上次更新時間:2025-01-25 (世界標準時間)。"],[[["The Smart Device Management API allows you to interact with Nest devices through traits, commands, and events."],["Traits represent device capabilities and their associated data, such as temperature or humidity, and are categorized by device type like Thermostat or Camera."],["Commands are used to control devices, for instance, changing the thermostat mode, while events provide asynchronous notifications about device state changes."],["You can access device information and traits through a GET request to the specified API endpoint using the device ID."],["Google Cloud Pub/Sub manages events and delivers them to a dedicated topic for each project ID, allowing you to stay updated on device activity."]]],[]]