简体   繁体   English

通过 MQTT 将 LoRa 测量值发送到 Fiware IOT 代理

[英]Send LoRa measures to Fiware IOT agent via MQTT

I have LoRa sensors which send measures with Cayenne LPP format payload.我有 LoRa 传感器,它使用 Cayenne LPP 格式有效载荷发送测量值。 My Gateway(LOrank8v1) catches these packets and converts them to UDP.我的网关(LOrank8v1)捕获这些数据包并将它们转换为 UDP。 In the gateway there is a service(lora-gateway-bridge) which converts the packets from UDP to TCP/MQTT.在网关中有一个服务(lora-gateway-bridge),它将数据包从 UDP 转换为 TCP/MQTT。

Then the MQTT packets are published to the mosquitto MQTT broker in the cloud.然后将 MQTT 数据包发布到云中的 mosquitto MQTT 代理。 Then i run lora-server and lora-app-server services in order to decrypt,decode and deduplicate the packets.然后我运行 lora-server 和 lora-app-server 服务以对数据包进行解密、解码和重复数据删除。

Then i publish the decrypted information to the MQTT broker again.然后我再次将解密的信息发布到 MQTT 代理。 Here is an example of a publication after all these operations: application/1/node/0000000000000000/rx以下是所有这些操作后发布的示例:application/1/node/00000000000000000/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
    }
  }
}

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.现在我想使用 Fiware 的 JSON/MQTT IOT 代理将 MQTT 转换为 NGSI,以便将数据发布到上下文代理。

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}'

Has anyone the same problem?有没有人有同样的问题? Should i make a JSON parser and republish the data to another format into the MQTT Broker?我应该制作一个 JSON 解析器并将数据以另一种格式重新发布到 MQTT Broker 中吗? How could i deal with this problem?我该如何处理这个问题?

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.您的步骤没问题,您需要将 Cayenne LPP 转换为所选代理所需的 JSON 格式。 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).当然,您首先需要通过代理注册您的设备,并在此步骤中定义设备将提供的不同参数(这将配置您必须如何发送 json 消息)。

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

This translation from Cayene to the "special-json-expected-by-the-agent" is a "non-desirable" step.这种从 Cayene 到“special-json-expected-by-the-agent”的翻译是一个“不受欢迎的”步骤。 Because you are doing cayene->json->NGSI (but I am not sure if there are other options).因为你在做 cayene->json->NGSI(但我不确定是否有其他选择)。 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.我们正在研究创建能够理解 Cayene 格式的新代理的可能性,但现在还为时过早,我不确定 MQTT 是否会成为选定的传输协议。 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...此外,lora-networ-server 也将与基于 Cayene 的组合 JSON 相关,所以......这会使任务变得更加复杂......让我们看看......

You should use the IoT Agent for Lorwan it supports Cayenne LPP.您应该使用 Lorwan 的 IoT 代理,它支持 Cayenne LPP。

https://fiware-lorawan.readthedocs.io/en/latest/ https://fiware-lorawan.readthedocs.io/en/latest/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM