מדריך לפרגולה לבית חכם

‫action.devices.types.PERGOLA – פרגולות (מבנה גינה חיצוני) שאפשר לפתוח ולסגור, לפעמים ביותר מכיוון אחד. לדוגמה, פרגולות מסוימות עם בד יכולות להיפתח שמאלה או ימינה.

הסוג הזה מציין שהמכשיר מקבל את הסמל של Pergola וכמה מילים נרדפות וכינויים שקשורים אליו.

תכונות המכשיר

במסמכי התיעוד של התכונה המתאימה מפורטים פרטי ההטמעה, כמו מאפיינים ומצבים שהשירות שלכם צריך לתמוך בהם, והסבר על אופן יצירת תשובות של EXECUTE ו-QUERY.

מאפיינים נדרשים

התכונות והפקודות האלה נדרשות, אם הן רלוונטיות למכשיר שלכם. אם המכשיר לא תומך בתכונות האלה, צריך להזין את קוד השגיאה functionNotSupported בתגובה של QUERY או EXECUTE. מידע נוסף זמין במאמר שגיאות וחריגים.

מומלץ להשתמש בתכונות האלה אם הן רלוונטיות למכשיר שלכם. עם זאת, אתם יכולים לשלב בין כל התכונות הזמינות כדי להתאים אותן בצורה הטובה ביותר לפונקציונליות הקיימת של המוצר.

דוגמה למכשיר: פרגולה פשוטה

בקטע הזה מופיעות דוגמאות למטענים ייעודיים (payloads) של כוונות שמייצגים 'פרגולה' נפוצה, על סמך סוג המכשיר והמאפיינים שצוינו למעלה. אם מוסיפים או מסירים מאפיינים בהטמעה, צריך לשנות את התגובות בהתאם כדי לשקף את השינויים האלה.

דוגמה לתגובת סנכרון

בקשה
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.PERGOLA",
        "traits": [
          "action.devices.traits.OpenClose",
          "action.devices.traits.Rotation"
        ],
        "name": {
          "name": "Simple pergola"
        },
        "willReportState": true,
        "attributes": {
          "openDirection": [
            "LEFT",
            "RIGHT"
          ],
          "supportsDegrees": false,
          "supportsPercent": true
        },
        "deviceInfo": {
          "manufacturer": "smart-home-inc",
          "model": "hs1234",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        }
      }
    ]
  }
}

דוגמה לתשובה של שאילתה

בקשה
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true,
        "openState": [
          {
            "openPercent": 30,
            "openDirection": "LEFT"
          },
          {
            "openPercent": 50,
            "openDirection": "RIGHT"
          }
        ],
        "rotationPercent": 30
      }
    }
  }
}

דוגמאות לפקודות EXECUTE

OpenClose

פרטים נוספים על פרמטרים של הפקודה זמינים במאמר בנושא action.devices.traits.OpenClose.

בקשה
{
  "requestId": "6894439706274654516",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.OpenClose",
                "params": {
                  "openPercent": 10,
                  "openDirection": "LEFT"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "PENDING",
        "states": {
          "online": true,
          "openState": [
            {
              "openPercent": 10,
              "openDirection": "LEFT"
            },
            {
              "openPercent": 50,
              "openDirection": "RIGHT"
            }
          ]
        }
      }
    ]
  }
}

OpenCloseRelative

פרטים נוספים על פרמטרים של הפקודה זמינים במאמר בנושא action.devices.traits.OpenClose.

בקשה
{
  "requestId": "6894439706274654518",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.OpenCloseRelative",
                "params": {
                  "openRelativePercent": 10,
                  "openDirection": "LEFT"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654518",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "PENDING",
        "states": {
          "online": true,
          "openState": [
            {
              "openPercent": 40,
              "openDirection": "LEFT"
            },
            {
              "openPercent": 50,
              "openDirection": "RIGHT"
            }
          ]
        }
      }
    ]
  }
}

RotateAbsolute

פרטים נוספים על פרמטרים של הפקודה זמינים במאמר בנושא action.devices.traits.Rotation.

בקשה
{
  "requestId": "6894439706274654520",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.RotateAbsolute",
                "params": {
                  "rotationPercent": 50
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654520",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "PENDING",
        "states": {
          "online": true,
          "rotationPercent": 50
        }
      }
    ]
  }
}

שגיאות במכשיר

רשימה מלאה של שגיאות וחריגים