All Collections
Connect your Devices
Connect your balena App to Ubidots
Connect your balena App to Ubidots

Learn how to add the Ubidots block to your balena app.

Santiago Pachon Robayo avatar
Written by Santiago Pachon Robayo
Updated over a week ago

BalenaBlocks are pre-built container images that developers may use to add important functionality to their multi-container apps, allowing for rapid prototyping and development. In this tutorial, you will learn how to easily integrate Ubidots into your balena app by adding the Ubidots block to a Fleet.


Table of contents

NOTE: In the tutorial, it is assumed that you already know how to create a fleet and a device in balena, in case you need guidance on how to do it you can check the balena documentation here , and also you can refer to the first two steps of this tutorial to get started with balena and Ubidots.

1. Create your app

You can use any of the examples found in this repository, for this tutorial, we’ll use the Python version and we will create the app or project on a local computer by copying the example found there.

The code inside the file generates random data which is sent to a device and also to a variable using MQTT to a broker running in the Ubidots Block.

2. Add the Ubidots block to your project

The docker-compose.yml includes the Ubidots balenaBlock container along with its required MQTT network and the volume. Whenever you want to add the Ubidots block to a balena app, make sure to include our image, network, and volume in your docker-compose.yml file as follows.

version: '2'


- ubidots-mqtt
restart: always
- ubidots-config:/ubidots/config



Don't forget to include your Ubidots token as a device variable as can be seen below.

3. Deploy your app using the balena CLI

While standing on the folder where you have your project, log in to your balena account using the balena CLI and then run the command:

balena push <name of your fleet>


Once the process concludes you will see the release id and version along with the image of a unicorn.


4. Verify data transmitted to Ubidots

You should be able to see the data received by Ubidots in your account as follows.

The Device label will be the same as the UUID provided by balena.

Others also found useful:

Did this answer your question?