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

action.devices.types.OVEN – אינטראקציה עם תנורים כוללת אפשרות לאפות או לאפות בטמפרטורות מסוימות. הטמפרטורה הפיזית בתוך התנור משתנה בזמן שהתנור מחמם, לכן ייתכן שצריך לעקוב גם אחרי המצב הזה. זמן הבישול לתנור מגביל את משך האפייה.

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

הדקדוק של תנורים מבוסס על סוגים עבור action.devices.traits.OnOff ו-action.devices.traits.TemperatureControl:
  • אם המכשיר תומך ב-OnOff, תחמם מראש את התנור תשלח את הפקודה action.devices.commands.OnOff.
  • אם המכשיר תומך בTemperatureControl, תחממו מראש את התנור ל-350 מעלות תשלח פקודה כדי לכוון את התנור לטמפרטורה הזו.

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

עיינו בתיעוד של התכונה המתאימה כדי לראות את פרטי ההטמעה, כמו מאפיינים ומצבים שבהם השירות צריך לתמוך, ואיך ליצור תשובות ב-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.OVEN",
        "traits": [
          "action.devices.traits.Cook",
          "action.devices.traits.OnOff",
          "action.devices.traits.TemperatureControl",
          "action.devices.traits.Timer",
          "action.devices.traits.StartStop"
        ],
        "name": {
          "name": "Simple oven"
        },
        "willReportState": true,
        "attributes": {
          "supportedCookingModes": [
            "BAKE",
            "CONVECTION_BAKE",
            "ROAST"
          ],
          "maxTimerLimitSec": 3600,
          "temperatureRange": {
            "minThresholdCelsius": 65,
            "maxThresholdCelsius": 288
          },
          "temperatureUnitForUX": "F"
        },
        "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,
        "on": true,
        "isRunning": true,
        "temperatureSetpointCelsius": 175,
        "currentCookingMode": "BAKE",
        "timerRemainingSec": -1
      }
    }
  }
}

פקודות 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": "ROAST"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "currentCookingMode": "ROAST"
        }
      }
    ]
  }
}

OnOff

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

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

SetTemperature

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

בקשה
{
  "requestId": "6894439706274654520",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.SetTemperature",
                "params": {
                  "temperature": 200
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654520",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "temperatureSetpointCelsius": 200,
          "temperatureAmbientCelsius": 100
        }
      }
    ]
  }
}

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": 300
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654522",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "timerRemainingSec": 300
        }
      }
    ]
  }
}

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": 290
        }
      }
    ]
  }
}

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": 300,
          "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": 300,
          "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": "6894439706274654532",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.StartStop",
                "params": {
                  "start": true
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654532",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "isRunning": true
        }
      }
    ]
  }
}

מכשיר ERRORS

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