### Install Python Device SDK
Source: https://thingsboard.io/docs/paas/reference/python-device-sdk
Use pip to install the required library.
```bash
pip3 install tb-mqtt-client
```
--------------------------------
### Install ThingsBoard CLI
Source: https://thingsboard.io/docs/paas/user-guide/cli
Install the CLI tool globally using uv.
```bash
uv tool install thingsboard-cli
```
--------------------------------
### Install the Python Client
Source: https://thingsboard.io/docs/paas/reference/python-client
Install the edition-specific package using pip.
```bash
pip install tb-paas-client==4.3.1.4
```
--------------------------------
### Check and Install SDK
Source: https://thingsboard.io/docs/paas/reference/micropython-client-sdk
Verifies if the SDK is already installed before attempting to install it via mip.
```python
try:
from thingsboard_sdk.tb_device_mqtt import TBDeviceMqttClient
print("thingsboard-micropython-client-sdk package already installed.")
except ImportError:
print("Installing thingsboard-micropython-client-sdk package...")
mip.install('github:thingsboard/thingsboard-micropython-client-sdk')
from thingsboard_sdk.tb_device_mqtt import TBDeviceMqttClient
```
--------------------------------
### Install and Configure HTTP Integration
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Steps to download, install, and configure the HTTP integration service.
```bash
wget https://dist.thingsboard.io/tb-http-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-http-integration-4.3.1.4pe.deb
```
```bash
sudo nano /etc/tb-http-integration/conf/tb-http-integration.conf
```
```bash
# UNCOMMENT NEXT LINES AND PUT YOUR CONNECTION PARAMETERS:
export RPC_HOST=thingsboard.cloud
export RPC_PORT=9090
export INTEGRATION_ROUTING_KEY=YOUR_INTEGRATION_KEY
export INTEGRATION_SECRET=YOUR_INTEGRATION_SECRET
```
```bash
sudo service tb-http-integration start
```
--------------------------------
### Manage MQTT Integration Service
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to download, install, configure, and start the MQTT integration service.
```bash
wget https://dist.thingsboard.io/tb-mqtt-integration-4.3.1.4pe.rpm
```
```bash
sudo rpm -Uvh tb-mqtt-integration-4.3.1.4pe.rpm
```
```bash
sudo nano /etc/tb-mqtt-integration/conf/tb-mqtt-integration.conf
```
```bash
sudo service tb-mqtt-integration start
```
--------------------------------
### Start existing integration container
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Starts a previously created integration container.
```bash
docker start my-tb-pe-coap-integration
```
--------------------------------
### Install and Configure MQTT Integration
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Steps to download, install, and open the configuration file for the MQTT integration.
```bash
wget https://dist.thingsboard.io/tb-mqtt-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-mqtt-integration-4.3.1.4pe.deb
```
```bash
sudo nano /etc/tb-mqtt-integration/conf/tb-mqtt-integration.conf
```
--------------------------------
### Install Integration Packages
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Install the downloaded .deb package using dpkg.
```bash
sudo dpkg -i tb-aws-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-azure-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-opc-ua-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-tcp-udp-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-coap-integration-4.3.1.4pe.deb
```
```bash
sudo dpkg -i tb-apache-pulsar-integration-4.3.1.4pe.deb
```
--------------------------------
### Basic Table Setup
Source: https://thingsboard.io/docs/paas/user-guide/contribution/widgets-development/widget-patterns
HTML and JavaScript setup for a basic entity table widget.
```HTML
```
```JavaScript
self.onInit = function() {
// Table initialization is handled by the component
};
self.onDataUpdated = function() {
self.ctx.$scope.entitiesTableWidget.onDataUpdated();
};
self.onEditModeChanged = function() {
self.ctx.$scope.entitiesTableWidget.onEditModeChanged();
};
self.typeParameters = function() {
return {
maxDatasources: 1,
hasDataPageLink: true,
warnOnPageDataOverflow: false,
dataKeysOptional: true,
defaultDataKeysFunction: function() {
return [{ name: 'name', type: 'entityField' }];
}
};
};
```
--------------------------------
### Example interactive wizard prompts
Source: https://thingsboard.io/docs/paas/user-guide/cli
Example of the prompts displayed during the interactive configuration process.
```text
ThingsBoard URL [https://thingsboard.cloud]:
Auth method [api_key]:
API Key: ********
Profile name: cloud
```
--------------------------------
### Install Java 17 on Ubuntu
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to install, configure, and verify OpenJDK 17.
```bash
sudo apt update && sudo apt install openjdk-17-jdk-headless
```
```bash
sudo update-alternatives --config java
```
```bash
java -version
```
```text
openjdk version "17.x.xx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (...)
```
--------------------------------
### Start Kafka Broker
Source: https://thingsboard.io/docs/paas/user-guide/integrations/kafka
Starts the Kafka server process using the standard configuration file.
```bash
bin/kafka-server-start.sh config/server.properties
```
--------------------------------
### Install Java and Kafka
Source: https://thingsboard.io/docs/paas/user-guide/integrations/kafka
Commands to install OpenJDK 17 and download the Kafka 4.3.1 binary distribution on Ubuntu.
```bash
sudo apt update
sudo apt install -y openjdk-17-jre-headless curl
java -version
cd /tmp
curl -fLO https://downloads.apache.org/kafka/4.3.1/kafka_2.13-4.3.1.tgz
sudo tar -xzf kafka_2.13-4.3.1.tgz -C /opt
sudo ln -s /opt/kafka_2.13-4.3.1 /opt/kafka
sudo chown -R "$USER":"$USER" /opt/kafka_2.13-4.3.1
cd /opt/kafka
```
--------------------------------
### Install MicroPython SDK
Source: https://thingsboard.io/docs/paas/reference/micropython-client-sdk
Installs the ThingsBoard MicroPython client library using the mip package manager.
```python
import mip
mip.install('github:thingsboard/thingsboard-micropython-client-sdk')
```
--------------------------------
### Manage TCP/UDP Integration Service
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to download, install, configure, and start the TCP/UDP integration service.
```bash
wget https://dist.thingsboard.io/tb-tcp-udp-integration-4.3.1.4pe.rpm
```
```bash
sudo rpm -Uvh tb-tcp-udp-integration-4.3.1.4pe.rpm
```
```bash
sudo nano /etc/tb-tcp-udp-integration/conf/tb-tcp-udp-integration.conf
```
```bash
sudo service tb-tcp-udp-integration start
```
--------------------------------
### Quickstart Java Client Implementation
Source: https://thingsboard.io/docs/paas/reference/java-client
Demonstrates authenticating with an API key, creating a device, sending telemetry, and deleting the device.
```java
import org.thingsboard.client.ApiException;
import org.thingsboard.client.ThingsboardClient;
import org.thingsboard.client.model.Device;
public class Quickstart {
public static void main(String[] args) throws ApiException {
ThingsboardClient client = ThingsboardClient.builder()
.url("https://thingsboard.cloud")
.apiKey("YOUR_API_KEY_VALUE")
.build();
Device newDevice = new Device();
newDevice.setName("Quickstart Device");
newDevice.setType("default");
Device savedDevice = client.saveDevice(newDevice, null, null, null, null, null, null);
String deviceId = savedDevice.getId().getId().toString();
client.saveEntityTelemetry("DEVICE", deviceId, "ANY", """
{"temperature": 22.4}
""");
System.out.println("Pushed telemetry to " + savedDevice.getName());
client.deleteDevice(deviceId);
}
}
```
--------------------------------
### Manage OPC-UA Integration Service
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to download, install, configure, and start the OPC-UA integration service.
```bash
wget https://dist.thingsboard.io/tb-opc-ua-integration-4.3.1.4pe.rpm
```
```bash
sudo rpm -Uvh tb-opc-ua-integration-4.3.1.4pe.rpm
```
```bash
sudo nano /etc/tb-opc-ua-integration/conf/tb-opc-ua-integration.conf
```
```bash
sudo service tb-opc-ua-integration start
```
--------------------------------
### Initialize a new project
Source: https://thingsboard.io/docs/paas/user-guide/cli
Create a new directory and initialize it as a ThingsBoard project.
```bash
mkdir my-iot-project && cd my-iot-project && tb init
```
--------------------------------
### Initialize and authenticate with credentials
Source: https://thingsboard.io/docs/paas/reference/dart-client
Example of creating a client instance, logging in with email and password, and fetching user details.
```dart
import 'package:thingsboard_client/thingsboard_client.dart';
const thingsBoardApiEndpoint = 'https://thingsboard.cloud';
void main() async {
try {
var tbClient = ThingsboardClient(thingsBoardApiEndpoint);
await tbClient.login(LoginRequest('[email protected]', 'tenant'));
print('isAuthenticated=${tbClient.isAuthenticated()}');
print('authUser: ${tbClient.getAuthUser()}');
var currentUserDetails = await tbClient.getUserService().getUser();
print('currentUserDetails: $currentUserDetails');
await tbClient.logout();
} catch (e, s) {
print('Error: $e');
print('Stack: $s');
}
}
```
--------------------------------
### Manage Azure Integration Service
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to download, install, configure, and start the Azure integration service.
```bash
wget https://dist.thingsboard.io/tb-azure-integration-4.3.1.4pe.rpm
```
```bash
sudo rpm -Uvh tb-azure-integration-4.3.1.4pe.rpm
```
```bash
sudo nano /etc/tb-azure-integration/conf/tb-azure-integration.conf
```
```bash
sudo service tb-azure-integration start
```
--------------------------------
### Initialize Node.js project
Source: https://thingsboard.io/docs/paas/recipes/websocket-live-telemetry
Create a project directory and install the required 'ws' library for WebSocket communication.
```bash
mkdir ws-telemetry && cd ws-telemetry
npm init -y
npm install ws
```
--------------------------------
### Manage AWS Integration Service
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to download, install, configure, and start the AWS integration service.
```bash
wget https://dist.thingsboard.io/tb-aws-integration-4.3.1.4pe.rpm
```
```bash
sudo rpm -Uvh tb-aws-integration-4.3.1.4pe.rpm
```
```bash
sudo nano /etc/tb-aws-integration/conf/tb-aws-integration.conf
```
```bash
sudo service tb-aws-integration start
```
--------------------------------
### Provisioning via Mosquitto CLI
Source: https://thingsboard.io/docs/paas/reference/mqtt-api/provisioning
Example commands to subscribe to the response topic and publish a provisioning request.
```bash
mosquitto_sub -d -q 1 -h "mqtt.thingsboard.cloud" -p 1883 -t "/provision/response" -u "provision"
```
```bash
mosquitto_pub -d -q 1 -h "mqtt.thingsboard.cloud" -p 1883 -t "/provision/request" -u "provision" -m '{"deviceName": "DEVICE_NAME", "provisionDeviceKey": "PUT_PROVISION_KEY_HERE", "provisionDeviceSecret": "PUT_PROVISION_SECRET_HERE"}'
```
--------------------------------
### Quickstart: Device Telemetry
Source: https://thingsboard.io/docs/paas/reference/python-client
Authenticate with an API key, create a device, push telemetry, and delete the device.
```python
import json
from tb_paas_client import ThingsboardClient
from tb_paas_client.models import Device
with ThingsboardClient("https://thingsboard.cloud", api_key="YOUR_API_KEY_VALUE") as client:
saved = client.save_device(Device(name="Quickstart Device", type="default"))
device_id = str(saved.id.id)
client.save_entity_telemetry(
entity_type="DEVICE",
entity_id=device_id,
scope="ANY",
body=json.dumps({"temperature": 22.4}),
)
print(f"Pushed telemetry to {saved.name}")
client.delete_device(device_id=device_id)
```
--------------------------------
### Manage HTTP Integration Service
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to download, install, configure, and start the HTTP integration service.
```bash
wget https://dist.thingsboard.io/tb-http-integration-4.3.1.4pe.rpm
```
```bash
sudo rpm -Uvh tb-http-integration-4.3.1.4pe.rpm
```
```bash
sudo nano /etc/tb-http-integration/conf/tb-http-integration.conf
```
```bash
sudo service tb-http-integration start
```
--------------------------------
### Perform API Request with cURL
Source: https://thingsboard.io/docs/paas/user-guide/security/api-keys
Example of using an API key to authenticate a GET request via cURL.
```bash
curl -X GET --header 'Accept: application/json' \
--header 'X-Authorization: ApiKey $YOUR_API_KEY_VALUE' \
'https://$THINGSBOARD_HOST_NAME/api/auth/user'
```
--------------------------------
### Connect to Wi-Fi and install SDK
Source: https://thingsboard.io/docs/paas/reference/micropython-client-sdk
Use this snippet to establish a network connection before installing the SDK via mip to avoid connection errors.
```python
import network
import mip
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('Connecting to network...')
wlan.connect("YOUR_WIFI_SSID", "YOUR_WIFI_PASSWORD")
while not wlan.isconnected():
pass
mip.install('github:thingsboard/thingsboard-micropython-client-sdk')
```
--------------------------------
### Install CircuitPython SDK via circup
Source: https://thingsboard.io/docs/paas/reference/circuitpython-client-sdk
Use this command to install the SDK when standard installation methods fail.
```bash
circup --host --password install thingsboard-circuitpython-client-sdk
```
--------------------------------
### Build and Run LwM2M Demo Client
Source: https://thingsboard.io/docs/paas/reference/lwm2m-api/ota-updates
Commands to clone, build, and execute the demo client with OTA support enabled for testing purposes.
```bash
git clone https://github.com/thingsboard/thingsboard.lwm2m.demo.client
mvn clean install
```
```bash
java -jar thingsboard-lwm2m-demo-client-{version}.jar -u coap://lwm2m.thingsboard.cloud:5685 -n MyClientNoSec -tota
```
--------------------------------
### Verify CLI installation
Source: https://thingsboard.io/docs/paas/user-guide/cli
Check the installed version of the CLI.
```bash
tb --version
```
--------------------------------
### Configure connection profile
Source: https://thingsboard.io/docs/paas/user-guide/cli
Launch the interactive wizard to set up a connection profile.
```bash
tb config
```
--------------------------------
### Start Services and Pull Model
Source: https://thingsboard.io/docs/paas/user-guide/local-ai-ollama
Commands to initialize the infrastructure and download a model.
```bash
docker compose -f docker-compose.bearer.yml up -d
```
```bash
docker exec -it ollama ollama pull gemma3:1b
```
--------------------------------
### Open Integration Configuration Files
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Open the configuration file for the installed integration using nano.
```bash
sudo nano /etc/tb-aws-integration/conf/tb-aws-integration.conf
```
```bash
sudo nano /etc/tb-azure-integration/conf/tb-azure-integration.conf
```
```bash
sudo nano /etc/tb-opc-ua-integration/conf/tb-opc-ua-integration.conf
```
```bash
sudo nano /etc/tb-tcp-udp-integration/conf/tb-tcp-udp-integration.conf
```
```bash
sudo nano /etc/tb-coap-integration/conf/tb-coap-integration.conf
```
```bash
sudo nano /etc/tb-apache-pulsar-integration/conf/tb-apache-pulsar-integration.conf
```
--------------------------------
### Install libcoap3-bin on Ubuntu
Source: https://thingsboard.io/docs/paas/reference/coap-api/getting-connected
Installs the libcoap3-bin package for modern Ubuntu releases.
```bash
sudo apt install libcoap3-bin
```
--------------------------------
### Clone the Integration Project
Source: https://thingsboard.io/docs/paas/user-guide/integrations/custom
Commands to download the official ThingsBoard remote integration example repository.
```bash
git clone https://github.com/thingsboard/remote-integration-example.git
cd remote-integration-example
```
--------------------------------
### Execute Firmware Installation
Source: https://thingsboard.io/docs/paas/reference/lwm2m-api/ota-updates
Triggers the installation of a firmware package after it has been delivered to the device.
```APIDOC
## Execute Firmware Installation
### Description
Triggers the installation of a firmware package on the device using an RPC call after the package has been delivered.
### Request Body
- **method** (string) - Required - The RPC method name, which must be "Execute".
- **params** (object) - Required - Contains the resource ID to execute.
- **id** (string) - Required - The resource path, specifically "/5/0/2".
### Request Example
{
"method": "Execute",
"params": {
"id": "/5/0/2"
}
}
```
--------------------------------
### Install Particle CLI
Source: https://thingsboard.io/docs/paas/user-guide/integrations/particle
Command to install the Particle command-line interface for managing credentials.
```bash
bash <( curl -sL https://particle.io/install-cli )
```
--------------------------------
### Install paho-mqtt dependency
Source: https://thingsboard.io/docs/paas/recipes/python-telemetry
Install the required MQTT client library via pip.
```bash
pip install paho-mqtt
```
--------------------------------
### Start ChirpStack Services
Source: https://thingsboard.io/docs/paas/user-guide/integrations/chirpstack
Command to start the ChirpStack environment using Docker Compose.
```bash
docker compose up
```
--------------------------------
### LwM2M Resource Targeting Examples
Source: https://thingsboard.io/docs/paas/reference/lwm2m-api/rpc-commands
Examples of how to target resources using paths, object versions, or device profile keys.
```json
{"id": "/3/0/9"}
```
```json
{"id": "/3_1.2/0/9"}
```
```json
{"key": "batteryLevel"}
```
--------------------------------
### Open Integration Class
Source: https://thingsboard.io/docs/paas/user-guide/integrations/custom
Path to the integration source file.
```bash
nano src/main/java/org/thingsboard/integration/custom/basic/CustomIntegration.java
```
--------------------------------
### MQTT Payload Example
Source: https://thingsboard.io/docs/paas/user-guide/integrations/mqtt
Example of a minimal JSON payload published to the sensor topic.
```json
{
"temperature": 25.1
}
```
--------------------------------
### Install MQTT Integration via Docker
Source: https://thingsboard.io/docs/paas/user-guide/integrations/remote
Commands to pull the image, prepare log storage, and run the MQTT integration container.
```bash
docker pull thingsboard/tb-pe-mqtt-integration:4.3.1.4PE
```
```bash
mkdir -p ~/.tb-pe-mqtt-integration-logs && sudo chown -R 799:799 ~/.tb-pe-mqtt-integration-logs
```
```bash
docker run -it -v ~/.tb-pe-mqtt-integration-logs:/var/log/tb-mqtt-integration \
-e "RPC_HOST=thingsboard.cloud" -e "RPC_PORT=9090" \
-e "INTEGRATION_ROUTING_KEY=YOUR_ROUTING_KEY" -e "INTEGRATION_SECRET=YOUR_SECRET" \
--name my-tb-pe-mqtt-integration --restart always thingsboard/tb-pe-mqtt-integration:4.3.1.4PE
```
--------------------------------
### Binary Payload Format Example
Source: https://thingsboard.io/docs/paas/user-guide/integrations/tcp
A 25-byte binary payload example for device communication.
```binary
\x30\x30\x30\x30\x11\x53\x4e\x2d\x30\x30\x32\x64\x65\x66\x61\x75\x6c\x74\x32\x35\x2e\x37\x00\x00\x00
```