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.

^ to conserve storage space, some LoRa data collection is reduced for items not needing high time-resolution data like VDD (stored every 10th reading) and SNR (stored every 4th reading).

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.

For Legacy v2 console depreciating December 2021.

  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, Q. 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

Revised for v3 TTN cluster (The Things Stack Community Edition) 2021

UPGRADE your BMON to the latest version before proceeding

  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 Webhook by clicking Integrations > Webhooks
  4. Select Custom Webhook from the list
    • Webhook ID: bmon-sensortype ex. bmon-dragino
    • Webhook Format: JSON
    • Base URL: http://yourbmon.url
    • Downlink API key: leave blank
    • Additional Headers: click Add Header Entry
      • in the first input box type store-key
      • in the second input box type your BMSAPP_STORE_KEY from settings.py
    • Enabled Messages:
      • click the checkbox for uplink message and enter /readingdb/reading/store-things/
  5. Add a Payload Decoder by clicking Payload Formats
  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.