以下是技能服务发现到一台能够回复油量、电量、续航距离,并能执行锁车操作的智联车的回复。
{ "event": { "header": { "namespace": "AliGenie.Discovery", "name": "Discover.Response", "payloadVersion": "1", "messageId": "abc-1234-xyz-7890" }, "payload": { "endpoints": [ { "endpointId": "car-001", "friendlyName": "My Car", "description": "My Car by The Car Manufacturer", "manufacturerName": "The Car Manufacturer", "displayCategories": [ "CONNECTED_CAR" ], "cookie": {}, "capabilities": [ { "type": "AliGenieInterface", "interface": "AliGenie.ConnectedCar", "version": "1", "properties": { "supported": [ { "name": "fuelLevel" }, { "name": "batteryLevel" }, { "name": "remainingRange" } ], "proactivelyReported": true, "retrievable": true } }, { "type": "AliGenieInterface", "interface": "AliGenie.ConnectedCar.LockController", "version": "1", "properties": { "supported": [ { "name": "lockState" } ], "proactivelyReported": true, "retrievable": true } }, { "type": "AliGenieInterface", "interface": "AliGenie", "version": "1" } ] } ] } } }
属性名称 | 类型 | 描述 |
---|---|---|
fuelLevel | 百分比 | 车子目前的油量 |
batteryLevel | 百分比 | 车子目前的电量 |
remainingRange | 距离 | 目前车子还能行驶的距离 |
location | 地理位置 | 车辆目前的位置 |
以下是一个支持 ConnectedCar
接口的设备在完成指令后的同步返回回复信息。
{ "context": { "properties": [ { "namespace": "AliGenie.ConnectedCar", "name": "cookCompletionTime", "value": "2017-08-31T23:36:15Z", "timeOfSample": "2017-08-31T23:30:00Z", "uncertaintyInMilliseconds": 0 }, { "namespace": "AliGenie.ConnectedCar", "name": "isCookCompletionTimeEstimated", "value": false, "timeOfSample": "2017-08-31T23:30:00Z", "uncertaintyInMilliseconds": 0 }, { "namespace": "AliGenie.ConnectedCar", "name": "cookStartTime", "value": "2017-08-31T23:30:00Z", "timeOfSample": "2017-08-31T23:30:00Z", "uncertaintyInMilliseconds": 0 }, { "namespace": "AliGenie.ConnectedCar", "name": "foodItem", "value": { "foodName": "Copper river salmon", "foodCategory": "FISH", "foodQuantity": { "@type": "Weight", "value": "2.5", "unit": "POUND" } }, "timeOfSample": "2017-08-31T23:30:00Z", "uncertaintyInMilliseconds": 0 }, { "namespace": "AliGenie.ConnectedCar.LockController", "name": "cookTime", "value": "PT6M15S", "timeOfSample": "2017-08-31T23:30:00Z", "uncertaintyInMilliseconds": 0 }, { "namespace": "AliGenie.ConnectedCar.WindowController", "name": "powerLevel", "value": { "@type": "EnumeratedPowerLevel", "value": "HIGH" }, "timeOfSample": "2017-08-31T23:30:00Z", "uncertaintyInMilliseconds": 0 } ] }, "event": { "header": { "namespace": "AliGenie", "name": "Response", "messageId": "abc-123-def-456", "correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", "payloadVersion": "1" }, "endpoint": { "scope": { "type": "BearerToken", "token": "access-token-from-Taobao" }, "endpointId": "appliance-001" }, "payload": {} } }
当技能因为某些原因无法完成用户的请求时,技能需要回复错误信息,相关回复格式请见 AliGenie.ConnectedCar.ErrorResponse
。对于更通用的错误回复,例如车辆不在线,请见 Error.Response
。
You should reply with an error if you cannot complete the customer request for some reason. For cooking-specific errors such as an appliance door is open, see Alexa.Cooking.ErrorResponse. For generic errors, such as a device is offline, see Error.Response.