OpenEnergyMonitor Community

Requesting mqtt data from LoRa server for emoncms node

I presently have a RAK7244 (chirpstack) running LoRa on my LAN which receives temp/hum data from two LHT65 sensors. I would like to add this data to an emonpi which I have running on the same LAN. I have the parts running but, not being a programmer, I don’t know how to integrate the two.

On the emonpi, when I issue the command [LoRa server is]:

mosquitto_sub -h -t “application/7/device/#” -d

I get:

{“applicationID”:“7”,“applicationName”:“LHT65”,“deviceName”:“LHT65x”,“devEUI”:“a8404117b18312e9”,“txInfo”:{“frequency”:905100000,“dr”:0},“adr”:true,“fCnt”:1232,“fPort”:2,“data”:“y+wJdQIKAQlZf/8=”,“object”:{“BatV”:3.052,“Ext_sensor”:“Temperature Sensor LHT65”,“Hum_SHT”:“52.2”,“TempF_DS”:“75.07”,“TempF_SHT”:“75.58”}}

I see a JSON format for the data at the end of the string and this is what I need to send to the emonpi as a new node.

I think this can be done with node-red but am having a hard time understanding how to do it.

If anyone has any suggestions or a similar example I could look at then it would be greatly appreciated.


Hi Bob

I’m not familiar with the RAK7244, so my experience might not help, but I have an Adafruit LoRa sending temperature data through mqtt on node-red back to the emonpi.

I run node-red on a separate raspberry pi as I think it was all too much on one system - especially if you want to use the browser interface.

In my case, I have an Adafruit LoRa receiver connected via the rPi serial and read the data packet using a “serial in” node. But I have also used the “mqtt in” and “mqtt out” node and they also work quite well.

The fiddly bit is to parse the json so it is in the right format for emonpi - but there are plenty of examples and you should be able to sort it even without programming background.

I need to go back into my old node-red setup and look for the code to parse the json. From memory, you need to split the json into an array, then select the elements you need. These can then be sent to the emonpi using the other node.

So I suggest you get a working node red platform, and using the browser interface see if you can read the json into a “debug” node. With this working, then add a “function” node that you can parse the json to extract the relevant data. This data then goes to emonpi through an mqtt out node (from memory).

If you get stuck, post what you have done and I’ll try and help - but there are quite a few node-red experts in the community here, so someone will be able to help.

Thanks for the help, Anthony. Node-Red is somewhat beyond me at this point. On the surface it looks simple but I have to figure out what it is doing. Does it create a piece of code from the flow chart which I then load onto my LoRa server? Sorry, but you can see I’m not a programmer.