本文介绍了通过MQTT将LoRa措施发送给Fiware IOT代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有LoRa传感器,可以发送Cayenne LPP格式有​​效负载的测量值.我的网关(LOrank8v1)捕获这些数据包并将其转换为UDP.网关中有一个服务(lora-gateway-bridge),可将数据包从UDP转换为TCP/MQTT.

I have LoRa sensors which send measures with Cayenne LPP format payload.My Gateway(LOrank8v1) catches these packets and converts them to UDP.In the gateway there is a service(lora-gateway-bridge) which converts the packets from UDP to TCP/MQTT.

然后,将MQTT数据包发布到云中的mosquitto MQTT代理.然后,我运行lora-server和lora-app-server服务,以便对数据包进行解密,解码和重复数据删除.

Then the MQTT packets are published to the mosquitto MQTT broker in the cloud.Then i run lora-server and lora-app-server services in order to decrypt,decode and deduplicate the packets.

然后,我再次将解密的信息发布到MQTT代理.这是完成所有这些操作后的发布示例:application/1/节点/0000000000000000/rx

Then i publish the decrypted information to the MQTT broker again.Here is an example of a publication after all these operations:application/1/node/0000000000000000/rx

{
 "applicationID":"1",
  "applicationName":"Temperature-Humidity",
  "deviceName":"Temperature-Humidity",
  "devEUI":"0000000000000  000",
  "rxInfo":[
    {
      "mac":"1dee18c14948a955",
      "rssi":-27,
      "loRaSNR":9.5,
      "name":"1dee18  c14948a955",
      "latitude":0,
      "longitude":0,
      "altitude":0
    }
  ],
  "txInfo": {
    "frequency":8685  00000,
    "dataRate": {
      "modulation":"LORA",
      "bandwidth":125,
      "spreadFactor":9
    },
    "adr":false,
    "codeRate":"4/5"
  },
  "fCnt":2,
  "fPort":1,
  "data":"AGcAxQFojA==",
  "object": {
    "temperatureSensor": {
      "0":19.7
    },
    "humiditySensor": {
      "1":70
    }
  }
}

现在,我想使用Fiware的JSON/MQTT IOT代理将MQTT转换为NGSI,以便将数据发布到Context Broker.

Now i want to use Fiware's JSON/MQTT IOT agent to convert MQTT to NGSI in order to publish data to the Context Broker.

应该像这样发布数据以便于阅读:

The data should be publised like this to be readable :

$ mosquitto_pub -h $HOST_IOTAGENT_MQTT -u theUser -P thePassword -t /myapikey/mydevicemqtt/attrs -m '{ "t": 19,7, "h": 70}'

有人有同样的问题吗?我应该进行JSON解析器,然后将数据重新发布为另一种格式到MQTT Broker中吗?我该如何解决这个问题?

Has anyone the same problem?Should i make a JSON parser and republish the data to another format into the MQTT Broker?How could i deal with this problem?

推荐答案

我不知道我是否正确理解了您的问题.一切正常,您需要一些将Cayenne LPP转换为所选代理所需的JSON格式的步骤.当然,您首先需要通过代理注册设备,然后在此步骤中,定义设备将提供的不同参数(这将配置发送JSON消息的方式).

I dont know if I understood correctly your problem. Your steps are ok, you need something to translate from Cayenne LPP to the JSON format expected by you selected agent. Of course, you first need to register your device through the agent, and in this step, you define the different parameters that would be provided by your device (this will configure how you will have to send your json message).

https://github .com/telefonicaid/iotagent-json/blob/master/docs/stepbystep.md#provisioning-the-device

从Cayene到特殊代理期望的特殊json-json"的翻译是不希望的"步骤.因为您正在执行cayene-> json-> NGSI(但我不确定是否还有其他选项).我们正在研究是否有可能创建一种能够理解Cayene格式的新代理,但是还很早,我不确定MQTT是否将成为所选的传输协议.此外,lora-networ-server还将与基于Cayene的组合JSON相关,所以...这会使任务更加复杂...让我们看看...

This translation from Cayene to the "special-json-expected-by-the-agent" is a "non-desirable" step. Because you are doing cayene->json->NGSI (but I am not sure if there are other options). We are studying the possibility of creating a new agent capable of understanding Cayene format, but it is still very early, and I am not sure if MQTT will be the selected transport protocol. Also, the lora-networ-server would also related to the composed JSON based on Cayene, so... this would make the task more complicated... lets see...

这篇关于通过MQTT将LoRa措施发送给Fiware IOT代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:55
查看更多