智能家居门铃指南

action.devices.types.DOORBELL - 门铃可以让人们知道门口有人。 如果具有相应功能,此设备可以发送通知和流式视频。

这种类型表示设备会获得门铃图标以及一些相关的同义词和别名。

设备功能

如需了解实现详情(例如您的服务应支持的特性和状态,以及如何构建 EXECUTE 和 QUERY 响应),请参阅相应的特征文档。

如果设备适用这些特征,建议提供。 不过,您可以自由组合搭配所有可用特征,以便与现有产品功能实现最佳匹配。

质量要求

  • 延迟时间:必须小于或等于 2000 毫秒
  • 可靠性:必须大于或等于 97%

示例设备:简单的门铃

本部分包含基于上述设备类型和特征来表示常见“门铃”的 intent 载荷示例。如果您在实现中添加或移除特征,请相应地修改响应以反映这些更改。

SYNC 响应示例

请求
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
响应
{
  "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"
        }
      }
    ]
  }
}

示例 QUERY 响应

请求
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
响应
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true
      }
    }
  }
}

EXECUTE 命令示例

GetCameraStream

如需详细了解命令参数,请参阅 action.devices.traits.CameraStream 参考文档。

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

示例 NOTIFICATIONS 报告

ObjectDetection

如需详细了解通知属性,请参阅 action.devices.traits.ObjectDetection 参考文档。

请求
{
  "requestId": "6894439706274654518",
  "payload": {
    "devices": {
      "notifications": {
        "123": {
          "ObjectDetection": {
            "objects": {
              "named": [
                "Alice"
              ]
            },
            "priority": 0,
            "detectionTimestamp": 946684800000
          }
        }
      }
    }
  }
}
响应
{
  "requestId": "6894439706274654518"
}

设备出错

查看错误和异常的完整列表。