Deploying ThingsBoard
Send telemetry from ALPON X5 AI or ALPON X4 to ThingsBoard through ALPON Cloud: create the ThingsBoard MQTT integration and topic filter, build a lightweight MQTT client container, push it to the Sixfab Container Registry, and verify the data in ThingsBoard.
Deploy ThingsBoard on ALPON
Connect your ALPON X5 AI or ALPON X4 to ThingsBoard and stream telemetry into its dashboards. This guide sets up an MQTT integration in ThingsBoard, builds a small MQTT client container that publishes a test reading through an external broker, and deploys it through ALPON Cloud.
Create an MQTT integration in ThingsBoard that listens on v1/devices/+/telemetry
at broker.hivemq.com:1883 with a TBEL uplink converter, build the thingsboard-mqtt-alpon-x4
MQTT client image and push it to your Sixfab Container Registry, then use the
Applications → Deploy panel on ALPON Cloud to launch it on your
ALPON X5 AI or ALPON X4 with the TOPIC, CLIENT_ID,
MQTT_SERVER, and MQTT_PORT environment variables. The reading appears under the
device's Latest telemetry tab in ThingsBoard.
Overview
ThingsBoard is an open-source IoT platform designed for the rapid development, management, and scaling of IoT projects. In this guide the ALPON X5 AI or ALPON X4 runs a lightweight MQTT client container that publishes telemetry to an external MQTT broker; a ThingsBoard MQTT integration subscribes to that broker, decodes the payload with a TBEL converter, and maps it to the right device.
The steps below are identical on ALPON X4 and ALPON X5 AI. For other integration types, converters, and dashboards, see the official ThingsBoard documentation.
You need an ALPON Cloud account, a ThingsBoard account, and an ALPON X5 AI or ALPON X4 registered and activated on ALPON Cloud with an active internet connection — see the ALPON X4 Getting Started page for setup instructions. Docker must be installed on your build machine to build and push the image. Familiarity with IoT concepts, containerized applications, and ThingsBoard dashboards helps. New to container deployment? Start with Containerize Apps for ALPON.
-
1
Create a device on ThingsBoard (optional)
The integration can create the device automatically the first time data arrives, so you can skip this step if you prefer. To create it manually, log in to your ThingsBoard instance and navigate to Entities → Devices in the sidebar.
The Devices page under Entities in ThingsBoard. Click the + icon in the top-right corner of the table and select Add new device.
Adding a new device from the Devices table. Enter the device name (for example
ALPON_X4). No other changes are required at this time. Click Add and close the window — the device is created.
The Add new device dialog with only the name filled in. -
2
Add the MQTT integration and topic filter
To transfer data from the ALPON to ThingsBoard via an external MQTT broker, you need an MQTT integration in ThingsBoard. The integration uses a topic filter to choose which MQTT topics to listen to and a data converter written in TBEL to process incoming data and map it to the appropriate device.
In ThingsBoard, open the Integrations section in the left-side menu and click the + icon to add a new integration.
The Integrations page in ThingsBoard. Select MQTT as the integration type.
Choosing MQTT as the integration type. In the Uplink data converter step, select TBEL, replace the default decoder with the code below, and click Next.
The uplink data converter step with TBEL selected. TBEL · uplink decoder// Decode an uplink message from a buffer // payload - array of bytes // metadata - key/value object /** Decoder **/ var payloadObj = decodeToJson(payload); var deviceName = 'ALPON X4'; var deviceType = 'alpon'; var groupName = 'alpon devices'; var manufacturer = 'Sixfab'; var result = { deviceName: deviceName, deviceType: deviceType, groupName: groupName, attributes: { model: 'X4', serialNumber: '111111111', manufacturer: manufacturer }, telemetry: { temperature: payloadObj.temperature, } }; /** Helper functions 'decodeToString' and 'decodeToJson' are already built-in **/ return result;Configure the broker details, then click Add:
Hostbroker.hivemq.comPort1883Topicv1/devices/+/telemetry— this filter determines which topics the integration listens to.
The MQTT connection settings with the HiveMQ broker and the topic filter. Understanding the topic filter
The topic filter
v1/devices/+/telemetryuses a single-level wildcard (+) that matches any single topic level in that position. It will match topics such as:v1/devices/device1/telemetryv1/devices/sensorA/telemetryv1/devices/room23/telemetry
It will not match topics such as:
v1/devices/device1/sensor/telemetry(because+matches only one level)v1/devices/telemetry(because a level is missing)v1/attributes/+/client(different topic structure)
This structure lets the integration process data from multiple devices, each using a unique identifier (for example
device1,sensorA,room23) in the topic. The ALPON can therefore send telemetry to ThingsBoard via the external broker, with the integration mapping the data to the correct device based on the topic structure. -
3
Add the MQTT client container
Next, build the MQTT client image on your local computer and push it to your Sixfab Container Registry so it is available to the device. Make sure Docker is installed on your machine — download it from docker.com if needed.
Create a file named
Dockerfilewith the following content to set up the environment for the MQTT client:DockerfileFROM alpine:latest RUN apk update && apk add \\ mosquitto-clients \\ mosquitto \\ python3 \\ py3-pip \\ bash RUN pip3 install paho-mqtt --break-system-packages WORKDIR /app COPY mqtt_test.py /app/ CMD ["python3", "/app/mqtt_test.py"]Create a file named
mqtt_test.pyin the same directory as the Dockerfile. This script makes the ALPON publish telemetry to ThingsBoard via MQTT — it connects to the broker, subscribes to the topic, and publishes a testtemperaturereading:python · mqtt_test.pyimport paho.mqtt.client as mqtt import json import ssl import time import os MQTT_SERVER = os.getenv("MQTT_SERVER") MQTT_PORT = os.getenv("MQTT_PORT") CLIENT_ID = os.getenv("CLIENT_ID") TOPIC = os.getenv("TOPIC") def on_connect(client, userdata, flags, rc): print(f"Connected with result code {rc}") client.subscribe(TOPIC, qos=0) print(f"Subscribed to topic: {TOPIC}") # Publish a test message after connecting test_message = { "temperature": 26 } client.publish(TOPIC, json.dumps(test_message), qos=0) print("Test message published.") def on_message(client, userdata, msg): print(f"RECEIVED MESSAGE on {msg.topic}:") try: message = json.loads(msg.payload.decode()) print(json.dumps(message, indent=4)) except Exception as e: print(f"Error decoding JSON: {e}") print(msg.payload.decode()) # Set up MQTT client client = mqtt.Client(client_id=CLIENT_ID, clean_session=True) # Set up callbacks client.on_connect = on_connect client.on_message = on_message # Enable SSL/TLS client.connect(MQTT_SERVER, int(MQTT_PORT), 60) # Start the loop client.loop_forever()Open a terminal in the directory containing the
Dockerfileandmqtt_test.py, and build thearm64image:bash · build the imagedocker build --platform=linux/arm64 -t thingsboard-mqtt-alpon-x4:latest .
Then log in to Sixfab Registry, click + Add Container, and follow the prompts to push the image.
The Sixfab Container Registry page on ALPON Cloud. Pushing images to the Sixfab Container RegistryFor the full walkthrough of tagging and pushing an image, see Update Containers from the Sixfab Container Registry and the Deploy Applications page.
-
4
Deploy the container on ALPON
Open your device in ALPON Cloud, go to the Applications section, and click + Deploy. In the Deploy Container window, use these settings:
Container Namethingsboard-mqtt-clientImageThethingsboard-mqtt-alpon-x4image and tag you pushed to the Sixfab Container Registry.EnvironmentClick + Add More in the environment section and add the four variables in the table below.Key Value TOPICv1/devices/alponx4/telemetryCLIENT_IDalponx4MQTT_SERVERbroker.hivemq.comMQTT_PORT1883
The Deploy Container window with the image selected and the four environment variables set. Click + Deploy to launch the MQTT client on the device.
Deploying the container from ALPON Cloud. -
5
Check the data on ThingsBoard
Once the container is running, verify that telemetry is received and displayed in ThingsBoard. Log in to your ThingsBoard instance, navigate to Entities → Devices, and select your ALPON X4 device. Open the Latest telemetry tab to view the
temperaturevalue sent by the container.
The test reading received by ThingsBoard under Latest telemetry. If nothing appears, confirm the container is running in the Applications section and that the
TOPICvalue matches the integration's topic filter from step 2.
- The
thingsboard-mqtt-clientcontainer shows as running in the Applications section. - The MQTT integration in ThingsBoard shows the connection as active.
- The ALPON X4 device lists a
temperaturereading under Latest telemetry.
The ALPON is now integrated with ThingsBoard over MQTT for real-time data collection: you created a device in ThingsBoard, added an MQTT integration, and deployed an MQTT client through ALPON Cloud. For further assistance, refer to the ThingsBoard documentation or contact Sixfab support.
Production image policy: Replace floating
:latestreferences with a reviewed immutable tag or digest, then record the selected version for rollback.
Updated 16 days ago
