智能家居摄像头指南
action.devices.types.CAMERA
- 相机非常复杂,功能会因供应商而异。随着时间的推移,相机将获得许多描述特定功能的特征和属性,其中许多特征和属性可能会以特殊方式与视频/音频流进行交互,如将流发送到其他设备、识别流中的内容、重放 Feed 等。
此类型表示设备会获得相机图标和一些相关的同义词和别名。
设备功能
如需了解相应的实现详情(例如您的服务应支持的属性和状态),以及如何构建 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.CAMERA", "traits": [ "action.devices.traits.CameraStream" ], "name": { "name": "Simple camera" }, "willReportState": true, "attributes": { "cameraStreamSupportedProtocols": [ "hls", "progressive_mp4" ], "cameraStreamNeedAuthToken": true, "cameraStreamNeedDrmEncryption": false }, "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": [ "progressive_mp4" ] } } ] } ] } } ] }
{ "requestId": "6894439706274654516", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "cameraStreamAccessUrl": "https://fluffysheep.com/baaaaa.mp4", "cameraStreamReceiverAppId": "1g2f89213hg", "cameraStreamAuthToken": "12657342190192783", "cameraStreamProtocol": "progressive_mp4" } } ] } }
设备出错
查看错误和异常的完整列表。resourceUnavailable
- 与生成视频流网址有关的任何失败。