智慧型住宅輪播的結構定義
action.devices.traits.Rotation
:這項特性屬於支援旋轉功能的裝置。
您可以用百分比或度為單位指定旋轉角度;如果裝置支援以度為單位旋轉,則預設旋轉方向為順時針。
裝置屬性
具有這項特徵的裝置可能會在 SYNC
作業中回報下列屬性。如要進一步瞭解如何處理 SYNC
意圖,請參閱意圖執行要求。
屬性 | 類型 | 說明 |
---|---|---|
supportsDegrees |
布林值 |
必要。 如果裝置允許旋轉角度,則設為 true。 |
supportsPercent |
布林值 |
必要。 如果裝置允許以百分比旋轉,則設為 true |
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 }
裝置 STATE
具有此特徵的實體可能會在 QUERY
作業中回報下列狀態。如要進一步瞭解如何處理 QUERY
意圖,請參閱意圖執行要求。
狀態 | 類型 | 說明 |
---|---|---|
rotationDegrees |
Number |
目前在 |
rotationPercent |
Number |
當前等級代表裝置目前旋轉的百分比。0.0 對應已關閉,而 100.0 與開啟的對應。 |
targetRotationPercent |
Number |
音量大小表示裝置隨著旋轉角度持續改變,將移動或移動到哪個位置的旋轉百分比。 |
示例
這部裝置旋轉了多少?。
{ "rotationDegrees": 45, "rotationPercent": 25 }
這部裝置旋轉了多少?(只有度數)。
{ "rotationDegrees": 45 }
這部裝置旋轉了多少?
{ "rotationDegrees": 270, "rotationPercent": 75 }
正在旋轉至新位置 (百分比) 的裝置。
{ "rotationPercent": 75, "targetRotationPercent": 100 }
裝置指令
具備這項特徵的裝置可能會在 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