智慧型住宅旋轉特徵結構定義
action.devices.traits.Rotation
:這個特性屬於支援旋轉功能的裝置。
旋轉可以指定百分比或度數;如果裝置支援以度為單位旋轉,預設的旋轉方向為順時針。
裝置屬性
具備這個特性的裝置可能會在 SYNC
作業中回報下列屬性。如要進一步瞭解如何處理 SYNC
意圖,請參閱「意圖執行要求」。
屬性 | 類型 | 說明 |
---|---|---|
supportsDegrees |
布林 |
必要。 如果裝置允許依次旋轉角度,請設為 true。 |
supportsPercent |
布林 |
必要。 如果裝置允許以百分比旋轉 |
rotationDegreesRange |
物件 |
代表裝置可旋轉的角度範圍。 |
rotationDegreesMin |
Number |
必要。 最小旋轉角度。 |
rotationDegreesMax |
Number |
必要。 最大旋轉角度。 |
supportsContinuousRotation |
布林 |
(預設值: 如果裝置允許持續旋轉,則設為 true。提供相對查詢時, |
commandOnlyRotation |
布林 |
(預設值: 指出裝置是否支援單向 (true) 或雙向 (false) 通訊。如果裝置無法回應此特性的 QUERY 意圖或報告狀態,請將此屬性設為 true。 |
範例
支援同時以百分比和度為單位旋轉的裝置。
{ "supportsDegrees": true, "supportsPercent": true, "rotationDegreesRange": { "rotationDegreesMin": 0, "rotationDegreesMax": 180 } }
裝置僅支援旋轉角度。
{ "supportsDegrees": true, "supportsPercent": false, "rotationDegreesRange": { "rotationDegreesMin": 0, "rotationDegreesMax": 90 } }
僅支援持續旋轉指令的裝置。
{ "supportsDegrees": true, "supportsPercent": true, "rotationDegreesRange": { "rotationDegreesMin": 0, "rotationDegreesMax": 360 }, "supportsContinuousRotation": true, "commandOnlyRotation": true }
裝置狀態
具有這個特性的實體可能會在 QUERY
作業中回報下列狀態。如要進一步瞭解如何處理 QUERY
意圖,請參閱「意圖執行要求」。
狀態 | 類型 | 說明 |
---|---|---|
rotationDegrees |
Number |
|
rotationPercent |
Number |
目前的等級,指出裝置目前的旋轉百分比。0.0 對應至封閉,100.0 則對應開啟。 |
範例
裝置旋轉了多少?(百分比和度)。
{ "rotationDegrees": 45, "rotationPercent": 25 }
裝置旋轉了多少?(只能加上度數)。
{ "rotationDegrees": 45 }
裝置旋轉了多少?(連續)
{ "rotationDegrees": 270, "rotationPercent": 75 }
裝置指令
具有這個特性的裝置可能會在 EXECUTE
作業中回應下列指令。如要進一步瞭解如何處理 EXECUTE
意圖,請參閱「意圖執行要求」。
action.devices.commands.RotateAbsolute
設定裝置的絕對旋轉角度。
參數
酬載包含下列其中一項:
設定絕對旋轉角度。
參數 | 類型 | 說明 |
---|---|---|
rotationDegrees |
Number |
必要。 以度為單位的絕對值,用來指定裝置最終順時針旋轉。值必須位於 |
以百分比設定絕對旋轉。
參數 | 類型 | 說明 |
---|---|---|
rotationPercent |
Number |
必要。 絕對值 (以百分比表示),用來指定裝置最終旋轉角度。 |
範例
將裝置傾斜到 50%。
{ "command": "action.devices.commands.RotateAbsolute", "params": { "rotationPercent": 50 } }
將裝置逆時針旋轉 15 度 (rotationDegrees: 45
)。
{ "command": "action.devices.commands.RotateAbsolute", "params": { "rotationDegrees": 30 } }
將裝置順時針旋轉 100 度 (supportsContinuousRotation: true
、rotationDegrees: 270
)。
{ "command": "action.devices.commands.RotateAbsolute", "params": { "rotationDegrees": 10 } }
相關錯誤
設定裝置的旋轉時發生錯誤。
支援的值:
deviceJammingDetected