how to integrate rak gateway into datacake via mqtt

This guide shows how to integrate your RAK gateway with Datacake using the built-in Network Server and its Generic MQTT Integration feature.

After completing this tutorial, your LoRaWAN® device data will be published via MQTT and visualized on the Datacake platform. 

Prerequisites

  • RAK gateway running WisGateOS 2

  • The gateway must have Internet access (via Ethernet, Wi-Fi, or cellular)

  • At least one LoRaWAN node device

  • Active Datacake account

  • An External MQTT Broker

Configure the RAK Gateway

Set Gateway Work Mode and Add Device

Before proceeding, make sure your gateway is already configured to use the built-in network server and that your LoRaWAN node has been added to an application.

For detailed instructions, refer to the WisGateOS 2 User Manual.

Configure MQTT Integration

  1. Go to LoRa® > Configuration > Integration interface parameters in the gateway’s web UI.

  2. Toggle the Enable Integration Interface option and select Generic MQTT as the integration mode.

  3. Configure the following MQTT parameters:

    mqtt.png
    • MQTT Broker Address: Enter the hostname of your MQTT server. Example: broker.hivemq.com

    • MQTT Broker Port: 1883

🗒️
NOTE

For X Industrial series gateways, the available MQTT integration parameters may differ slightly.
However, similar to Edge and SoHo series gateways, the primary configuration required here is the MQTT broker address and port.
Other parameters can be left at their default values unless specific customization is needed.

4. Click Save changes to apply the configuration.

Configure the Datacake

Add a Device

  1. Log in to your Datacake account.

  2. Navigate to All Devices and click + Add Device.

  3. Select API as the connectivity type of your device, and click Next.

  4. Choose New Product, enter a product name, and click Next.

  5. On Step 2, leave the Serial Number blank (Datacake will generate one automatically), then click Next.

  6. Choose a payment plan and confirm.

Your device now appears in the Devices list.

Configure MQTT

  1. Open the device page and go to Configuration.

  2. Under Product & Hardware, scroll to MQTT Configuration.

  3. Click + Add new MQTT Server and provide your broker details.

🗒️
NOTE

(Optional) Click Test Connection to check connectivity.

  1. Click Add MQTT Server.

  2. Under MQTT Uplink Decoders, click + Add Uplink Decoder.

  3. Add the MQTT topics. Ensure that the format exactly matches the configuration on the gateway.
    Example: application/MyApplication/device/#

  4. Provide a Decoder function if you want to parse payloads. 

  5. Click Add Uplink Decoder, then click Save.

Once the MQTT integration is active and uplinks are received, the Last Data column in Datacake will update with timestamps.

Create Fields in Datacake

In Datacake, device values are stored as Fields (data points).

  1. Go to the Fields tab.

  2. Click + Add Field to create one or more data points for your device.

  3. Once uplink data is received, the Current Value column will update automatically.

🗒️
NOTE

If your device transmits multiple sensor values, create multiple fields.

Visualize Data on Dashboard

  1. Open your device and switch to the Dashboard tab. Click the edit icon (11.png ) to enable Edit mode.

  2. Click + Add Widget and select a visualization type. 

  3. Assign the widget to one of your device fields. 

  4. Save your dashboard and exit Edit mode.

🗒️
NOTE

You can create multiple widgets if your device reports multiple sensor values.

Troubleshooting

Issue Possible Cause Suggested Action
Last Data shows “Never” No uplink data is reaching Datacake.
  • Check that the gateway has Internet access.
  • Ensure the MQTT Broker address/port are correct and reachable.
  • Verify that the MQTT topics in Datacake exactly match the ones configured on the gateway (e.g., application/{{application_name}}/device/{{device_EUI}}/#).
  • Make sure the Decoder function is configured based on your device type so that uplink payloads are parsed correctly.
MQTT Connection Fails The Gateway cannot connect to the broker.
  • Confirm broker credentials (username/password, if required).
  • Test the broker using an MQTT client (e.g., MQTT Explorer, mosquitto_sub).
  • Ensure the broker allows external connections (check firewall and ACL rules).

FAQs

1. Can I use Datacake without public MQTT brokers?
Yes. Datacake supports custom private brokers with credentials and TLS.

2. Can I push data from multiple gateways?

  • Yes. Each gateway can be configured with the same MQTT broker.

  • Ensure DevEUI is unique per device.

3. What is the benefit of using MQTT vs. HTTP integrations?

  • MQTT is better for real-time data streaming, lower latency, and bi-directional support (future use cases).

  • HTTP is simple but more suitable for batch or one-way reporting.

4. How can I confirm that Datacake is receiving data?
Check the Last Data timestamp in the device page. If it shows Never, refer to Troubleshooting.

5. Why is no data shown in Fields?
Ensure Fields are created in Datacake, and that the Decoder function outputs keys matching the Field names. 

6. How can I debug MQTT message flow?
Use MQTT Explorer or mosquitto_sub to confirm messages reach the broker. This helps identify if the issue is gateway → broker or broker → Datacake.

 


Changelog
  • Version 1 - How to integrate RAK Gateway into DataCake via MQTT
    • Date Published: 11/01/2025

Updated