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

action.devices.types.MICROWAVE - אינטראקציות עם מכשירי מיקרוגל עשויות לכלול הפעלה ועצירה, הגדרת טיימר, שינוי מצבי בישול והגדרות קבועות מראש של אוכל, ושינוי של מצבים שאינם בישול.

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

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

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

התכונות הנדרשות

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

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

דרישות איכות

  • זמן האחזור:חייב להיות 3000 אלפיות שנייה או שווה לו.
  • אמינות: הערך צריך להיות 97% או יותר.

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

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

תגובת SYNC לדוגמה

בקשה
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.MICROWAVE",
        "traits": [
          "action.devices.traits.Cook",
          "action.devices.traits.Timer",
          "action.devices.traits.StartStop"
        ],
        "name": {
          "name": "Simple microwave"
        },
        "willReportState": true,
        "attributes": {
          "supportedCookingModes": [
            "DEFROST",
            "MICROWAVE",
            "WARM"
          ],
          "maxTimerLimitSec": 6039,
          "pausable": true
        },
        "deviceInfo": {
          "manufacturer": "smart-home-inc",
          "model": "hs1234",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        }
      }
    ]
  }
}

דוגמה לתגובה QUERY

בקשה
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true,
        "isRunning": true,
        "isPaused": false,
        "timerRemainingSec": 60,
        "currentCookingMode": "WARM"
      }
    }
  }
}

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

בישול

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.Cook.

בקשה
{
  "requestId": "6894439706274654516",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.Cook",
                "params": {
                  "start": true,
                  "cookingMode": "MICROWAVE"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "currentCookingMode": "MICROWAVE"
        }
      }
    ]
  }
}

TimerStart

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.Timer.

בקשה
{
  "requestId": "6894439706274654522",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.TimerStart",
                "params": {
                  "timerTimeSec": 60
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654522",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "timerRemainingSec": 60
        }
      }
    ]
  }
}

TimerAdjust

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.Timer.

בקשה
{
  "requestId": "6894439706274654524",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.TimerAdjust",
                "params": {
                  "timerTimeSec": -10
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654524",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "timerRemainingSec": 50
        }
      }
    ]
  }
}

TimerPause

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.Timer.

בקשה
{
  "requestId": "6894439706274654526",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.TimerPause"
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654526",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "timerRemainingSec": 60,
          "timerPaused": true
        }
      }
    ]
  }
}

TimerResume

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.Timer.

בקשה
{
  "requestId": "6894439706274654528",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.TimerResume"
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654528",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "timerRemainingSec": 60,
          "timerPaused": false
        }
      }
    ]
  }
}

TimerCancel

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.Timer.

בקשה
{
  "requestId": "6894439706274654530",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.TimerCancel"
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654530",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "timerRemainingSec": -1
        }
      }
    ]
  }
}

StartStop

לפרטים נוספים על הפרמטרים של הפקודות, אפשר לעיין בחומר העזר בנושא action.devices.traits.StartStop.

בקשה
{
  "requestId": "6894439706274654518",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.StartStop",
                "params": {
                  "start": true
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654518",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "isRunning": true,
          "isPaused": false
        }
      }
    ]
  }
}

מכשיר ERRORS

מומלץ לעיין ברשימה המלאה של שגיאות וחריגים.