智慧型住宅旋轉特性結構定義
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 對應。 |
範例
裝置的旋轉角度有多大?(百分比與角度)。
{ "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