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

คู่มือ Set-top box สมาร์ทโฮม

action.devices.types.SETTOP - การโต้ตอบกับโปรแกรมเล่นวิดีโอแบบหลายช่อง (MVPD) และอุปกรณ์ Set-top box อาจรวมถึงการควบคุมการเล่นสื่อ

ประเภทนี้เป็นการบ่งชี้ว่าอุปกรณ์จะได้รับไอคอน Set-top box รวมถึงคําพ้องความหมายและชื่อแทนที่เกี่ยวข้องบางรายการ

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

อ่านรายละเอียดเกี่ยวกับลักษณะการใช้งาน เช่น แอตทริบิวต์และรัฐที่บริการควรรองรับ ตลอดจนวิธีสร้างการตอบกลับ "EXECUTE" และ "QUERY"

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

ต้องมีลักษณะเฉพาะและคําสั่งเหล่านี้ หากเกี่ยวข้องกับอุปกรณ์ของคุณ

ลักษณะเฉพาะ คำสั่ง
action.devices.traits.AppSelector
  • action.devices.commands.appSelect
action.devices.traits.InputSelector
  • action.devices.commands.setInput
action.devices.traits.MediaState
  • ไม่มีข้อมูล
action.devices.traits.OnOff
  • action.devices.commands.OnOff
action.devices.traits.TransportControl
  • action.devices.commands.mediaClosedCaptioningOff
  • action.devices.commands.mediaClosedCaptioningOn
  • action.devices.commands.mediaNext
  • action.devices.commands.mediaPause
  • action.devices.commands.mediaPrevious
  • action.devices.commands.mediaResume
  • action.devices.commands.mediaStop
action.devices.traits.Volume
  • action.devices.commands.mute
  • action.devices.commands.setVolume

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

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

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

อุปกรณ์ตัวอย่าง: Set-top box แบบง่าย

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

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

คําขอ
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
คําตอบ
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.SETTOP",
        "traits": [
          "action.devices.traits.OnOff",
          "action.devices.traits.AppSelector",
          "action.devices.traits.MediaState",
          "action.devices.traits.Channel",
          "action.devices.traits.TransportControl"
        ],
        "name": {
          "name": "Simple set-top box"
        },
        "willReportState": true,
        "attributes": {
          "transportControlSupportedCommands": [
            "NEXT",
            "PREVIOUS",
            "PAUSE",
            "STOP",
            "RESUME",
            "CAPTION_CONTROL"
          ],
          "availableApplications": [
            {
              "key": "youtube",
              "names": [
                {
                  "name_synonym": [
                    "Youtube",
                    "Youtube_en"
                  ],
                  "lang": "en"
                }
              ]
            }
          ],
          "availableChannels": [
            {
              "key": "ktvu2",
              "names": [
                "Fox",
                "KTVU"
              ],
              "number": "2"
            },
            {
              "key": "abc1",
              "names": [
                "ABC",
                "ABC East"
              ],
              "number": "702.4-11"
            }
          ],
          "supportActivityState": true,
          "supportPlaybackState": 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,
        "currentApplication": "youtube",
        "activityState": "ACTIVE",
        "playbackState": "PAUSED"
      }
    }
  }
}

ตัวอย่างคําสั่ง EXECUTE

ปิด

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

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

ติดตั้งแอป

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.AppSelector

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

การค้นหาแอป

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.AppSelector

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

เลือกแอป

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.AppSelector

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

เลือกช่อง

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.Channel

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

แชแนลแบบสัมพัทธ์

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.Channel

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

คืนสินค้า

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.Channel

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

ปิดคําบรรยายสื่อ

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

ปิดคําบรรยายสื่อ

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

สื่อถัดไป

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

หยุดสื่อชั่วคราว

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

สื่อก่อนหน้า

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

เล่นสื่อต่อ

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

หยุดสื่อ

โปรดดูรายละเอียดเพิ่มเติมเกี่ยวกับพารามิเตอร์คําสั่งในข้อมูลอ้างอิง action.devices.traits.TransportControl

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

อุปกรณ์ ERRORS

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