Datacake Docs
  • Welcome
  • Get Started
  • Changelog
  • Best practices
    • Best practices: Getting started
    • Best practices: Resolution (Timeframe)
    • Best practices: Dashboards
    • Best practices: Reports
    • Best practices: Grouping Devices
  • Datacake LNS
    • Getting Started
    • Gateways
      • Milesight LoRaWAN Gateway - UG6x
      • RAKwireless WisGate Edge Light 2
    • Devices
    • Add Devices without Gateway
  • Wireless IoT Hub
    • Overview
    • Datasheet
    • Getting Started
  • Device
    • Product
    • Configuration
    • Claiming
    • Historical Data
    • Database
      • Configuration Fields
      • Fields
        • Manual input
        • Field Roles
        • Formulas
        • Mapping Fields
      • Data retention & Datapoints
      • Examples
        • Mapping 4-20mA Signals
        • Converting Units
  • Dashboards
    • Global Dashboards
      • Setting Homepage
    • Device Dashboards
    • Multi-Device Dashboards
    • Widgets
      • Value Widget
      • Chart Widget
      • Image Map
      • Map Widget
      • Text Widget
      • SOS Widget
      • Boolean Widget
      • iFrame Widget
      • Downlink Widget
      • Set Value Widget
      • Measurement List Widget
      • Heatmap Widget
      • Table Widget
      • Image Widget
  • Portal
    • Multi-Tenancy (Workspaces)
    • Reports
      • Energy Report
    • Administrators
    • Members
      • API Users
    • Security & Privacy
    • Billing
      • Support Packages
      • VAT Exemption / Tax ID
      • SMS Credits
      • Access Invoices
      • Unused time and Remaining time in Invoices (Prorations)
      • Codes
    • White Label
    • Rules
      • Legacy Rule Engine
        • Sending notifications via Telegram
      • New Rule Engine
        • Rule Engine Table Overview
        • Copy/Paste and Template Functionality
        • Advanced Rule Engine E-Mail and Webhook Templates
        • Time Restrictions
        • Actions
          • Set Value
    • Zones
  • Cake Red
    • Get Started
    • Overview
  • LoRaWAN
    • Get Started
      • CSV Import
      • Custom LoRaWAN Device
    • Configuring LNS
      • The Things Stack (TTN / TTI) Automated Setup
      • The Things Stack (TTN / TTI) Manual Setup
      • Loriot
      • Kerlink Wanesy
      • Helium
      • ChirpStack
      • Tektelic
      • Actility ThingPark
      • Senet
      • Milesight Gateway
      • KPN
    • Downlinks (LoRaWAN)
      • Set Time Frame
    • Securing Webhooks
    • Payload Decoders
      • Location and GPS
      • Access Gateway Metadata
      • Access Measurements
      • Global Variables
    • Using Cayenne LPP
    • Converting Payload
  • Generic API Devices
    • HTTP Downlinks
  • Integrations
    • MQTT
    • Particle
      • Get Started
      • Adding Integrations
      • Decoding Payloads
      • Calling Functions
      • Templates
        • Particle Tracker One
    • Incoming Webhooks
    • Outgoing Webhooks
      • Securing Outgoing Webhooks in Datacake
    • Golioth
    • Blues Wireless Notecard
    • Sigfox
    • Swarm Asset Tracker
    • Grandcentrix Modbus Cloud Connect
    • YuDash LYNX IoT Gateway
    • Dragino NB-IoT
      • Changing NB-IoT Bands
    • Hardwario CHESTER
    • 1NCE OS
  • API
    • Exporting Data
    • Record Measurements via API
    • Node RED to Datacake
    • Generate Access Token
    • Internal MQTT
      • Get Started
      • MQTT Documentation
      • MQTT over WebSocket
      • Example Code
    • GraphQL API
      • Using GraphQL
      • Device Creation
      • Tutorials
        • Read Group via Tags
  • Guides
    • Python
    • Send Slack Notifications
    • Forward Data to Cake Red
    • Multiple Data Feeds
    • Automated Dynamic Downlinks
    • Ingesting JSON Data into Datacake API Devices
    • Working with Default HTTP Decoder on API Devices and Code Examples
    • Accessing Measurements in Decoders
    • Connecting Datacake to Notion Using Zapier
    • How to set up and use location on non-GPS devices
    • How to integrate with AWS IoT Core
    • How to Schedule Mass-Downlinks (Multicast) using Datacake Rule Engine
    • How to Map Sensor Values to Ranges or Booleans, Strings using Mapping Fields
    • Understanding Internal vs. External MQTT Brokers on Datacake
    • Sending UDP Messages between 1NCE OS and Datacake
    • Concepts of LoRaWAN Payload Decoders on Datacake
    • How to check if a value stays above or below limits for given time
Powered by GitBook
On this page
  • Payload Decoder
  • Quick Start
  • MQTT
  • GraphQL API
  • Subsequent processes
  • Rules
  • Outgoing Webhooks

Was this helpful?

  1. Guides

Multiple Data Feeds

How to record data from third-party feeds on your LoRaWAN, MQTT or API devices by speaking directly to the Datacake API.

Introduction

Do you use Datacake for your LoRaWAN devices and feed the data via an LNS?

But did you know that you can also feed the data in parallel via other interfaces into the same device, even if they do not originate from the LNS?

Yes, you can! And this is not only possible with LoRaWAN but also with other types of devices.

The reason for this is that every device on Datacake is first an API device and therefore can also be fed with data via our rest-API but also MQTT interface, even if in parallel a LoRaWAN adapter automatically feeds the data via the payload decoder.

The following interfaces are available:

  • GraphQL API

  • MQTT API

Payload Decoder

With the above interfaces, you talk directly to the database. Data that is inserted through these interfaces, therefore, does not go through the payload decoders either.

By the way, your LoRaWAN Payload Decoder on Datacake does nothing else. At the end of the run, the payload decoder also uses the REST API to write the data to the database then finally.

If you need payload decoders for API or MQTT as well, then you should create a generic API device.

Quick Start

MQTT

The simplest variant for the parallel back feed of data into the respective Datacake device is via MQTT. You can find helpful information about this in the configuration view of your Datacake device.

Navigate to the configuration of your device and look for the MQTT section. There you will find a button that shows a modal with MQTT information when clicked.

On the modal you will recognize the following text.

The device will publish its measurements on the broker mqtt.datacake.co under the topic dtck/mclimate-vicki-19/983d51f5-6d38-4dcc-afc7-59e6aff062f4/+.

To record measurements, publish to dtck-pub/mclimate-vicki-19/983d51f5-6d38-4dcc-afc7-59e6aff062f4/[FIELD_NAME].

Depending on which device you open on your page, the information will look different. They contain your device's product ID and device ID, but the structure is the same.

You can now use these topics to:

  • Start subscriptions to incoming readings.

  • Write measured values via MQTT into a database field of the device.

We will now deal with the latter.

Connect to Broker

First, you must connect to the internal Datacake MQTT broker using an MQTT client (standalone, Node-RED or Cake Red). For this, you need an API key, which also has rights for the respective device, not only read but also write rights.

A detailed guide can be found in the following article.

Publish Measurement

If the connection to the broker is established, you can now use MQTT to write measured values to your respective device. To do this, simply publish a message to the topic specified in the modal.

As you can see, the last element in the Publish-Topic is enclosed in brackets. This is a placeholder for the field. So please enter here the identifier of the field (as you find it in the database).

Then as payload, send as plain text the value which you want to write here to the database. For temperature, for example:

  • Topic: dtck-pub/mclimate-vicki-19/983d51f5-6d38-4dcc-afc7-59e6aff062f4/TEMPERATURE

  • Payload: 23.01

Or as a boolean, e.g.:

  • Topic: dtck-pub/mclimate-vicki-19/983d51f5-6d38-4dcc-afc7-59e6aff062f4/DOOR_STATUS

  • Payload: 1 (Booleans must be translated to 0 = False or 1 = True)

GraphQL API

In parallel to using the MQTT Api, our GraphQL API can also be used. The principle is identical here. You write the data via API into the respective database field via HTTP post.

Have a look at the following documentation.

You will find the Datacake GraphQL API Python Wrapper in the following link:

Subsequent processes

Writing measured values via MQTT or API also triggers downstream processes.

Rules

Rules are evaluated in exactly the same way as the normal device feed (via LoRaWAN, MQTT or API Payload Decoder).

Outgoing Webhooks

For outgoing webhooks, it is a little bit different. These offer the option to trigger at various events, including:

  • Payload Decoder Output

  • Database Measurement Change

If data is written to the database via the MQTT or API interface, then outgoing webhooks are only triggered if Database Measurement Change is enabled.

Please pay attention to infinite loops when triggering a write operation with outgoing webhooks, for example. We will disable the device if this happens.

Last updated 1 year ago

Was this helpful?

GraphQL API
Connecting to the Broker
python-datacake-api-wrapper/datacake_graphql_client.py at main · datacake/python-datacake-api-wrapperGitHub
Logo