ThingPark X -in short TPX- is the module of the ThingPark platform in charge of dataflow processing. TPX can perform decoding of binary uplink payload to JSON, encoding of REST commands to binary commands, normalization and transformation of data, and it also manages the connections with other services (such as MQTT servers) and platforms (e.g. Microsoft Azure IoT Hub). In this step we will use the mosquitto.org MQTT broker, so we will simply create a new MQTT connection instance.
Setting up the dataflow
*TCP connection should not he used in production usage since it is not secure, use TLS instead.
If the configuration is correct , you will see OPENED icon at the right top of the screen: the TPX engine successfully connected to the target MQTT broker at mosquitto.org. If it shows “FAILED” instead, then check your configuration and the status of the MQTT broker.
You need to check if the configuration of the new TPX MQTT connection is correct and whether TPX could connect to the target MQTT Server
The TPX engine of ThingPark Community already has a comprehensive library of CoDecs, and they regularly get updated by the development team as well as the community. You can also write your own custom CoDec, or contribute it on the GIT repository. These CoDecs are very handy to process the collected sensor data with no coding effort. In this cookbook, we are using the Tinovi LoRaWAN® IO Module, which already has a CoDeC available in the TPX CoDec library.
Previously, in the Hello LoRaWAN® and Thingpark cookbook, the device had been created on ThingPark Community with generic parameters (“Generic” as Manufacturer and “LoRaWAN® 1.0.2 revC – Class A” as Model), because we didn’t need any device specific parsing.
Now let’s change it to the correct Manufacturer (Tinovi) and Model (LoRaWAN® Soil Moisture…) in the Devices console as shown in the figure. This information allows the TPX dataflow to automatically select the appropriate CoDec.
Let’s ensure that the MQTT connection instance is active and successfully connected to the MQTT broker, and that the sensor uplinks are routed to the correct backend connection. We will use the TPX console health status and logger.
In this activity, you will install an Android application called IoT MQTT Panel on your phone.
Customization of the mobile phone application involves two steps:
The first setting you need to configure in the application is to define broker connection settings. In this step, we will set up the MQTT Broker Service. The critical definition required is the MQTT Broker’s address and port number.
The application still requires more customization to display the data. Data is shown in panels, so you need to create a panel to display it.
Another critical point to remember is the “topic name” that the TPX connection is going to publish to the MQTT broker:
You may not have noticed that topic name when creating the TPX connection because we used the default topic name. But now that information will be used.
The device we use sends the data in the following format:
Which is decoded into JSON format by TPX, as shown below:
You need to use the Text Log type panel and customize it to show temperature reading.
In order to show the humidity value, create a clone of the temperature panel.
Now, update the cloned temperature panel to show the humidity readings.