智慧型住宅感應器指南
action.devices.types.SENSOR
- 單一感應器可以支援多種功能,例如監控溫度和濕度,或是溫度和入座情形。感應器可能會回報或同時回報定量資料 (例如以百萬分之一為單位的一氧化碳和煙霧濃度) 以及定性測量結果,例如空氣品質是否健康或不健康。
這個類型表示裝置會取得感應器圖示和一些相關的同義詞和別名。
裝置功能
請參閱相應特徵說明文件,進一步瞭解實作詳細資料,例如您的服務應支援的屬性和聲明,以及如何建構 EXECUTE 和 QUERY 回應。
建議的 traits
建議使用這些特徵 (如適用)。 不過,您也可以自由混用所有可用特質,以與現有產品功能最完美搭配。
-
action.devices.traits.SensorState
-
action.devices.traits.EnergyStorage
-
action.devices.traits.OccupancySensing
感應器也可能會使用有關其可回報的資料的其他特徵,例如:
品質規定
- 延遲時間:必須小於或等於 1000 毫秒。
- 可靠性:大於或等於 97%。
裝置範例:簡易感應器
本節包含根據裝置類型和特徵所適用的常見「感應器」範例意圖酬載。如果您在實作中新增或移除特徵,請根據變更項目修改回應。
SYNC 回應範例
{ "requestId": "6894439706274654512", "inputs": [ { "intent": "action.devices.SYNC" } ] }
{ "requestId": "6894439706274654512", "payload": { "agentUserId": "user123", "devices": [ { "id": "123", "type": "action.devices.types.SENSOR", "traits": [ "action.devices.traits.EnergyStorage", "action.devices.traits.SensorState" ], "name": { "name": "Simple sensor" }, "willReportState": true, "attributes": { "sensorStatesSupported": [ { "name": "AirQuality", "descriptiveCapabilities": { "availableStates": [ "healthy", "moderate", "unhealthy", "very unhealthy" ] } } ], "queryOnlyEnergyStorage": true }, "deviceInfo": { "manufacturer": "smart-home-inc", "model": "hs1234", "hwVersion": "3.2", "swVersion": "11.4" } } ] } }
QUERY 回應範例
{ "requestId": "6894439706274654514", "inputs": [ { "intent": "action.devices.QUERY", "payload": { "devices": [ { "id": "123" } ] } } ] }
{ "requestId": "6894439706274654514", "payload": { "devices": { "123": { "status": "SUCCESS", "online": true, "currentSensorStateData": [ { "name": "AirQuality", "currentSensorState": "healthy" } ], "descriptiveCapacityRemaining": "HIGH", "capacityRemaining": [ { "unit": "PERCENTAGE", "rawValue": 90 } ] } } } }