ยินดีต้อนรับสู่ศูนย์นักพัฒนาซอฟต์แวร์ Google Home ซึ่งเป็นจุดหมายใหม่เกี่ยวกับวิธีพัฒนาการดําเนินการสําหรับบ้านอัจฉริยะ หมายเหตุ: คุณจะสร้างการดําเนินการต่างๆ ต่อไปในคอนโซลการดําเนินการ

คู่มือทําอาหารสําหรับบ้านอัจฉริยะ

action.devices.types.COOKTOP - การโต้ตอบกับเตาปรุงอาหารอาจรวมถึงการเปิดและปิด การเริ่มและการหยุด การตั้งค่าตัวจับเวลา การปรับเปลี่ยนโหมดการทําอาหารและค่าที่กําหนดล่วงหน้าเกี่ยวกับอาหาร และการปรับการตั้งค่าโหมดทําอาหารแบบต่างๆ

ประเภทนี้บ่งชี้ว่าอุปกรณ์รับไอคอน Cooktop รวมถึงคําพ้องความหมายและชื่อแทนที่เกี่ยวข้องบางส่วน

ความสามารถของอุปกรณ์

โปรดดูเอกสารประกอบที่เกี่ยวข้องสําหรับรายละเอียดการใช้งาน เช่น แอตทริบิวต์และสถานะที่บริการของคุณควรมี และวิธีการสร้างการตอบกลับและคําขอ EXECUTE

ลักษณะเฉพาะที่จําเป็น

ต้องมีคุณลักษณะและคําสั่งเหล่านี้ หากสามารถใช้กับอุปกรณ์ของคุณ

เราขอแนะนําให้มีคุณสมบัติเหล่านี้ (หากใช้ร่วมกับอุปกรณ์ของคุณ) อย่างไรก็ตาม คุณสามารถผสมผสานคุณลักษณะที่มีอยู่ทั้งหมดได้เพื่อจับคู่กับฟังก์ชันการทํางานของผลิตภัณฑ์ที่มีอยู่

ข้อกำหนดด้านคุณภาพ

  • เวลาในการตอบสนอง: ต้องน้อยกว่าหรือเท่ากับ 800 มิลลิวินาที
  • ความเสถียร: ต้องมากกว่าหรือเท่ากับ 97%

อุปกรณ์ตัวอย่าง: เตาปรุงอาหารแบบเรียบง่าย

ส่วนนี้ประกอบด้วยเปย์โหลด Intent ตัวอย่างที่แสดง "Cooktop" ทั่วไปโดยอิงตามประเภทอุปกรณ์และลักษณะข้างต้น หากเพิ่มหรือนําลักษณะเฉพาะออกจากการใช้งาน ให้แก้ไขคําตอบให้สอดคล้องกับการเปลี่ยนแปลงเหล่านั้น

ตัวอย่างการตอบสนอง SYNC

คําขอ
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
คําตอบ
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.COOKTOP",
        "traits": [
          "action.devices.traits.Cook",
          "action.devices.traits.StartStop",
          "action.devices.traits.Timer",
          "action.devices.traits.OnOff"
        ],
        "name": {
          "name": "Simple cooktop"
        },
        "willReportState": true,
        "attributes": {
          "supportedCookingModes": [
            "COOK",
            "BOIL",
            "SAUTE"
          ],
          "foodPresets": [
            {
              "food_preset_name": "chicken_key",
              "supported_units": [
                "POUNDS",
                "OUNCES"
              ],
              "food_synonyms": [
                {
                  "synonym": [
                    "Chicken",
                    "Chicken breast",
                    "Chicken thigh"
                  ],
                  "lang": "en"
                }
              ]
            },
            {
              "food_preset_name": "bacon_key",
              "supported_units": [
                "POUNDS",
                "OUNCES"
              ],
              "food_synonyms": [
                {
                  "synonym": [
                    "Bacon",
                    "Bacon strips"
                  ],
                  "lang": "en"
                }
              ]
            }
          ],
          "maxTimerLimitSec": 1200,
          "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,
        "on": true,
        "isRunning": true,
        "isPaused": false,
        "timerRemainingSec": 120,
        "currentCookingMode": "COOK",
        "currentFoodPreset": "chicken_key"
      }
    }
  }
}

ตัวอย่างคําสั่ง 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": "BOIL"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
คําตอบ
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "currentCookingMode": "BOIL",
          "currentFoodPreset": "NONE"
        }
      }
    ]
  }
}

จุดเริ่มต้น

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง 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
        }
      }
    ]
  }
}

เริ่มจับเวลา

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง 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
        }
      }
    ]
  }
}

ตัวตั้งเวลาปรับ

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง 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": 110
        }
      }
    ]
  }
}

หยุดจับเวลาชั่วคราว

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง 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": 120,
          "timerPaused": true
        }
      }
    ]
  }
}

จับเวลาต่อ

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง 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": 120,
          "timerPaused": false
        }
      }
    ]
  }
}

ยกเลิกตัวจับเวลา

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง 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
        }
      }
    ]
  }
}

ปิด

ดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งได้ที่การอ้างอิง action.devices.traits.OnOff

คําขอ
{
  "requestId": "6894439706274654532",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.OnOff",
                "params": {
                  "on": true
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
คําตอบ
{
  "requestId": "6894439706274654532",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "on": true
        }
      }
    ]
  }
}

อุปกรณ์ ERRORS

ดูรายการข้อผิดพลาดและข้อยกเว้นทั้งหมด