智慧型住宅旋轉結構定義

action.devices.traits.Rotation - 這個特性屬於支援旋轉功能的裝置。

以百分比或度數指定旋轉角度,如果裝置支援度數旋轉,預設的旋轉方向就會順時針移動。

裝置屬性

具此特性的裝置可能會在 SYNC 作業中回報下列屬性。如要進一步瞭解如何處理 SYNC 意圖,請參閱意圖執行要求

屬性 類型 說明
supportsDegrees 布林

必要。

如果裝置允許按度數旋轉,則設為 true。

supportsPercent 布林

必要。

如果裝置允許按百分比輪播,請設為 true

rotationDegreesRange 物件

代表裝置可旋轉的範圍。

rotationDegreesMin Number

必要。

旋轉角度下限。

rotationDegreesMax Number

必要。

最大旋轉角度。

supportsContinuousRotation 布林

(預設值:false)

如果裝置允許持續旋轉,則設為 true。指定相對查詢時,RotateAbsolute 指令會在支援的旋轉範圍周圍納入納入範圍。

commandOnlyRotation 布林

(預設值:false)

指出裝置是否支援單向 (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

rotationDegreesRange 目前的等級,表示裝置旋轉了多少度。這個值應一律順時針旋轉。

rotationPercent Number

目前裝置旋轉次數的目前層級。0.0 代表關閉,100.0 則代表開啟。

範例

裝置旋轉了多少方向?(百分比和角度)。

{
  "rotationDegrees": 45,
  "rotationPercent": 25
}

裝置旋轉了多少方向?(僅限角度)。

{
  "rotationDegrees": 45
}

裝置旋轉了多少方向?(連續)。

{
  "rotationDegrees": 270,
  "rotationPercent": 75
}

裝置指令

具有此特性的裝置可能會回應 EXECUTE 作業中的下列指令。如要進一步瞭解如何處理 EXECUTE 意圖,請參閱意圖執行要求

action.devices.commands.RotateAbsolute

設定裝置的絕對旋轉角度。

參數

酬載包含下列內容:

設定絕對旋轉角度。

參數 類型 說明
rotationDegrees Number

必要。

絕對值 (以度為單位),指定裝置最終的順時針旋轉。值必須在 rotationDegreesRange 屬性內。

設定絕對輪播百分比。

參數 類型 說明
rotationPercent Number

必要。

絕對值,以百分比表示裝置最終旋轉。

範例

將裝置調降為 50%。

{
  "command": "action.devices.commands.RotateAbsolute",
  "params": {
    "rotationPercent": 50
  }
}

將裝置逆時針旋轉 15 度 (rotationDegrees: 45)。

{
  "command": "action.devices.commands.RotateAbsolute",
  "params": {
    "rotationDegrees": 30
  }
}

將裝置順時針旋轉 100 度 (supportsContinuousRotation: truerotationDegrees: 270)。

{
  "command": "action.devices.commands.RotateAbsolute",
  "params": {
    "rotationDegrees": 10
  }
}

設定裝置旋轉時發生錯誤。

支援的值:

deviceJammingDetected

裝置 ERRORS

請參閱錯誤和例外狀況的完整清單。