Panduan Bel Pintu Smart Home

action.devices.types.DOORBELL - Bel pintu dapat memberi tahu orang bahwa ada seseorang di depan pintu. Perangkat ini dapat mengirim notifikasi dan melakukan streaming video jika memiliki kemampuan yang sesuai.

Jenis ini menunjukkan bahwa perangkat mendapatkan ikon Bel Pintu dan beberapa sinonim dan alias terkait.

Kemampuan perangkat

Lihat dokumentasi karakteristik yang sesuai untuk mengetahui detail penerapan, seperti atribut dan status yang harus didukung layanan Anda, serta cara membuat respons EXECUTE dan QUERY.

Karakteristik ini direkomendasikan, jika berlaku untuk perangkat Anda. Namun, Anda bebas mencampur dan mencocokkan semua sifat yang tersedia agar paling sesuai dengan fungsi produk yang ada.

Contoh perangkat: Bel pintu sederhana

Bagian ini berisi contoh payload intent yang merepresentasikan "Bel Pintu" umum berdasarkan jenis dan karakteristik perangkat di atas. Jika Anda menambahkan atau menghapus ciri dalam penerapan, ubah respons Anda dengan tepat untuk mencerminkan perubahan tersebut.

Contoh respons SYNC

Permintaan
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
Respons
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.DOORBELL",
        "traits": [
          "action.devices.traits.CameraStream",
          "action.devices.traits.ObjectDetection"
        ],
        "name": {
          "name": "Simple doorbell"
        },
        "willReportState": true,
        "notificationSupportedByAgent": true,
        "attributes": {
          "cameraStreamSupportedProtocols": [
            "hls"
          ],
          "cameraStreamNeedAuthToken": true
        },
        "deviceInfo": {
          "manufacturer": "smart-home-inc",
          "model": "hs1234",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        }
      }
    ]
  }
}

Contoh respons QUERY

Permintaan
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
Respons
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true
      }
    }
  }
}

Contoh perintah EXECUTE

GetCameraStream

Untuk mengetahui detail tambahan tentang parameter perintah, lihat referensi action.devices.traits.CameraStream.

Permintaan
{
  "requestId": "6894439706274654516",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.GetCameraStream",
                "params": {
                  "StreamToChromecast": true,
                  "SupportedStreamProtocols": [
                    "hls"
                  ]
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
Respons
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "cameraStreamAccessUrl": "https://example.com/stream.mp4",
          "cameraStreamProtocol": "hls"
        }
      }
    ]
  }
}

Contoh laporan NOTIFIKASI

ObjectDetection

Untuk mengetahui detail tambahan tentang properti notifikasi, lihat referensi action.devices.traits.ObjectDetection.

Permintaan
{
  "requestId": "6894439706274654518",
  "payload": {
    "devices": {
      "notifications": {
        "123": {
          "ObjectDetection": {
            "objects": {
              "named": [
                "Alice"
              ]
            },
            "priority": 0,
            "detectionTimestamp": 946684800000
          }
        }
      }
    }
  }
}
Respons
{
  "requestId": "6894439706274654518"
}

ERROR Perangkat

Lihat daftar lengkap error dan pengecualian.