Integrating LoRa Devices into BMON with TTN

Q: Can a LoRa device post data into BMON?

A: Yes! The following discussion will show you how to set up sensors in The Things Network to post data to BMON.

This assumes you have a LoRa device and its Device EUI, App EUI, and App Key. These should be provided with the sensor, if they were not provided by the retailer, contact them and request access. If the retailer will not oblige, contact the device manufacturer and include the Device EUI in your correspondence and they should be able to assist.

  1. Create an account with The Things Network and open your Console

  2. Create an application for each sensor type

    • Once your application is created, edit it to add your APP EUI
  3. Add an HTTP Integration by clicking Integrations > Add Integration

  4. Select HTTP Integration from the list

    • Process ID: bmon-sensortype ex. bmon-dragino
    • Access Key: select default key [devices] [messages]
    • URL: http://yourbmon.url/readingdb/reading/store-things/
    • Method: POST
    • Authorization: leave blank
    • Custom Header Name: store-key
    • Custom Header Value: Your BMSAPP_STORE_KEY from settings.py
  5. Add a Payload Decoder by clicking Payload Formats

    • Payload Format: Custom
    • click decoder and paste your code there - decoders can be device specific so you must look for the correct one for your device - google The Things Network Payload Decoder device type for more
      • Elsys Decoder, make sure you select The Things Network decoder
      • Dragino LHT65 Decoder
      • Dragino Downloads Directory - find all your Dragino sensor payloads here
      • Netvox R311G Lux Decoder
        • function Decoder(bytes, port) {
          if (bytes[0] === 0x01 && bytes[1] === 0x04 && bytes[2] === 0x01) {
          // decode as shown in earlier post
          var battery = (bytes[3] / 10);
          var light = (bytes[4] << 8) | bytes[5];
          return {
          battery: battery,
          light: light,
          };
          }
          }
  6. Add your sensor to the application by clicking Devices > register device.

  7. If everything has been done correctly you should now start seeing sensors post to your BMON site, remember to check the unassigned-sensors page if you haven’t already added the sensor to BMON.

1 Like

Thanks for the all the info, Kristen. Here is a document with some more details on setting up LoRaWAN sensors so they can post data to BMON:

Some of the needed Payload Decoders are inside the document.

1 Like