智慧型住宅旋轉特徵結構定義
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
}裝置狀態
具有此特徵的實體可能會在 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