Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

How to create data points to handle MQTT from multiple devices?


  • Here is my setup.

    I have 7 devices in the field that send data via GPRS to a server running an MQTT broker (Mosquitto). Each device sends a topic with the device identification and then the sensor reading, eg device01/pressure and the payload contains the value. Every device sends the data values and only the device ID is different for each unit.

    I am trying to work out the best way to create the data points in Mango and handle this with a drop-down selection to select each device so that the data on the screen switches to that device. I will also have an overview display for all the important sensors that will navigate to the more detailed view.

    I was thinking to create a single data point for a device and then export this to see the Excel format and then create a PC programme to generate this same format as an Excel file and then import this into Mango or is there an easier way? I could simply edit the Excel by hand but this is prone to errors. A simple software program would allow just the device ID to be input.

    What is the best way to create these data points in mango so that adding a new device is quick and doesn't require any lengthly input of data points?


  • My suggestion would be saving into an alphanumeric point that triggers a scripted datasource. Parse the information provided and create/set separate virtual datapoints with it. You can affix the virtual points with tags (ideal for your device id) or an xid of your choice to make it easier to select and pull data for display.
    IMO, keep it generic and dynamic if you can. Gives you more breathing room for future amendments.

    Edit: Another thought. If you're going to use a basic application to handle the incoming data you can draw on the mango api to make your points on the fly if an insertion fails.


  • Hi v8dave,

    What is the best way to create these data points in mango so that adding a new device is quick and doesn't require any lengthly input of data points?

    The best way is what makes sense to you so that you can maintain the solution after its deployment.

    Fox's suggestion to use a script to parse values out of an alphanumeric is definitely what I would suggest if it was always the same topic the data was coming from or if there was more than one value in the payload. You could have the script automatically create data points on itself or a virtual data source for new devices' data.

    However, it sounds to me like the topic name contains the device identifier, so what I think you're asking is about creating MQTT points on the MQTT data source for new topics. Am I understanding that?

    You could still have a scripting data source create the points for you from an alphanumeric point. There are a few examples around the forum, but the JsonEmport script utility would let you copy exported JSON from a manually created point into the script as an object, modify it appropriately when a new value is set to the alphanumeric trigger point, and then stringify and import the new JSON to create the new points.


  • @v8dave said in How to create data points to handle MQTT from multiple devices?:

    I am trying to work out the best way to create the data points in Mango

    I would create the a of data points for a single device using the UI, add a tag like sensorId or just use the device name to identify the device. Then export this set of data points as a CSV. For every new device edit the CSV and re-import. You would only need to change the columns for the topic and the tags and/or device name.

    @v8dave said in How to create data points to handle MQTT from multiple devices?:

    handle this with a drop-down selection to select each device so that the data on the screen switches to that device. I will also have an overview display for all the important sensors that will navigate to the more detailed view.

    Create a tag based watch list and then use this in the dashboard designer.


  • @jared-wiltshire That works for me as I only have about 20 data points per device. By using the device ID as part of the XID, and the topic, this means a simple find and replace in Excel and then save and import works.


  • @v8dave said in How to create data points to handle MQTT from multiple devices?:

    @jared-wiltshire That works for me as I only have about 20 data points per device. By using the device ID as part of the XID, and the topic, this means a simple find and replace in Excel and then save and import works.

    It doesn't really matter either way but you can just leave the XID blank and it will create new unique XIDs for each data point.

    Also we have toyed around with creating a templating system to easily create sets of data points for a device like this but haven't come up with a great solution yet. I am sure it is something that is going to keep coming up, so we could be re-visiting this space.


  • For another option, the strategy I took was that I created global scripts to create the data points (MQTT/Modbus, virtual, meta) for my devices.

    The scripts I have are:
    dataPointJsonTempates
    --> This script contains the minimal set of values I need to set for each type of data point.
    createDataPointFunction
    --> This script contains the list of points I need for each of the devices. It loops through each list of points and calls the appropriate function below.
    createDeviceFunctions
    --> This script creates each of the appropriate data point, event detector, and event handlers.

    The intention was to detect the error generated when an unknown MQTT topic is subscribed to and create the required data points from the device id in the topic. I haven't gotten that working yet but it is a lower priority item at the moment.

    For now, I have a scripting data source to call the function:
    createDevice('PCU_110006');

    I have created multiple 'createDataPointFunctions' scripts for the different devices I need. The same pattern is applied.

    Ian