我的配置包括orion、IoT代理JSON和mongoDB。我想要建立一个Fiware灯驱动器,我想有开关状态(作为传感器)以及。
目前,我在body (form ORION)中使用了修补程序请求:首先使用on命令:
{
"on": {
"type" : "command",
"value" : ""
}
}然后用off命令:
{
"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": ""
}发布于 2020-11-05 09:26:54
命令的流如下所示:

假设您的命令已经到达lamp并打开它,则需要将结果传递回IoT代理。对于JSON IoT代理,有效负载如下所示:
{"on" : "OK"}其中键是命令的名称,值是状态。我的猜测是,您的设备只是在没有有效负载的情况下响应200 OK,因此IoT代理不知道哪个命令已经启动。
注意,在分布式网络的情况下(例如MQTT或AMPQ),响应将异步发布到另一个主题上,因此命令可能在一段时间内处于PENDING状态。
https://stackoverflow.com/questions/64689177
复制相似问题