【发布时间】:2020-11-04 23:32:27
【问题描述】:
我的配置包括 orion、IoT Agent JSON 和 mongoDB。 我想构建一个 Fiware Lamp 执行器,并且我也想拥有开/关状态(作为传感器)。
目前我使用带有正文的 PATCH 请求(形式 ORION): 首先使用 on 命令:
{
"on": {
"type" : "command",
"value" : ""
}
}
然后用关闭命令:
{
"off": {
"type" : "command",
"value" : ""
}
}
当我从上面收到任何内容时,我会从虚拟设备回复 200 OK。
我的配置中的上述内容使 on 和 off 标记都处于待处理状态:
{
"id": "urn:ngsi-ld:Lamp:001",
"type": "Lamp",
"TimeInstant": "2020-11-04T22:42:37.00Z",
"category": [
"actuator",
"sensor"
],
"controlledProperty": "lamp",
"function": [
"onOff",
"sensing"
],
"off_info": " ",
"off_status": "PENDING",
"on_info": " ",
"on_status": "PENDING",
"refStore": "urn:ngsi-ld:Store:001",
"state": " ",
"supportedProtocol": [
"JSON"
],
"supportedUnits": "My Unit 2",
"on": "",
"off": ""
}
我想我错过了一些东西,那么我是否必须将任何响应发送回 IoT 代理 json 以使两个标签之一停止待处理?我必须在此过程中更新状态或信息吗?
P.S 我希望得到这样的回复:
{
"id": "urn:ngsi-ld:Lamp:001",
"type": "Lamp",
"TimeInstant": "2020-11-04T22:42:37.00Z",
"category": [
"actuator",
"sensor"
],
"controlledProperty": "lamp",
"function": [
"onOff",
"sensing"
],
"off_info": " ",
"off_status": "PENDING",
"on_info": " ",
"on_status": "OFF",
"refStore": "urn:ngsi-ld:Store:001",
"state": " ",
"supportedProtocol": [
"JSON"
],
"supportedUnits": "My Unit 2",
"on": "",
"off": ""
}
【问题讨论】: