功能描述:设备主动获取设备影子
直连设备: $sys/{pid}/{did}/shadow/get
子设备: $sys/{gpid}/{gdid}/{pid}/{did}/shadow/get
Payload:
{
"pid":"123",
"did":"123",
"method":"get"
}
Responses:
直连设备 $sys/{pid}/{did}/shadow/get/resp
子设备 $sys/{gpid}/{gdid}/{pid}/{did}/shadow/get/resp
{
"method":"reply",
"payload":{
"status": "success",
"state": {
"desired": {
"color": "RED",
},
"reported": {
"color": "GREEN"
}
},
"metadata": {
"desired": {
"color": {
"timestamp": 1469564492
},
},
"reported": {
"color": {
"timestamp": 1469564492
}
}
}
},
"timestamp": 1469564492,
"version": 1
}
功能描述:设备主动更新/删除设备影子
直连设备: $sys/{pdi}/{did}/shadow/update
子设备: $sys/{gpid}/{gdid}/{pdi}/{did}/shadow/update
Payload:
// 更新
{
"pid":"123",
"did":"123",
"method":"update",
"state":{
"reported": {
"color": "RED"
}
},
"version":3
}
// 删除影子中某一属性
{
"pid":"123",
"did":"123",
"method": "delete",
"state": {
"reported": {
"color": "null",
"temperature": "null"
}
},
"version": 1
}
// 删除影子全部属性
{
"pid":"123",
"did":"123",
"method": "delete",
"state": {
"reported": "null"
},
"version": 1
}
Responses:
直连设备: $sys/{pid}/{did}/shadow/update/resp
子设备: $sys/{gpid}/{gdid}/{pid}/{did}/shadow/update/resp
Payload:
// 成功
{
"method": "reply",
"payload": {
"status": "success",
"version": 1
},
"timestamp": 1469564576
}
//失败
{
"method": "reply",
"payload": {
"status": "error",
"content": {
"errorcode": "${errorcode}",
"errormessage": "${errormessage}"
}
},
"timestamp": 1469564576
}