How can I add a device into an application?

From the doc: https://www.balena.io/docs/learn/welcome/primer/#device-provisioning

“Unless someone downloads the OS from your dashboard (or via the CLI), a device cannot enter your application.”

Is it impossible to force my device to enter my application using balena sdk?
I found register function in Python SDK - https://www.balena.io/docs/reference/sdk/python-sdk/#function-registerapp_id-uuid

But how can I configure my RPi device to be linked to my application?

Cheers.

Hi,

Registering to an application should be possible using the CLI:
https://www.balena.io/docs/reference/cli/#device-register-application

Regards!

Thanks for your quick reply, @spanceac

Yeah, I already checked that, but once registered, the device is still OFFLINE on my balena cloud dashboard.

How can I configure my RPi to communicate with the registered application?
(I downloaded the image file from https://www.balena.io/os/, not from my balena cloud dashboard)

Cheers,
Shane.

Hi,

The easiest way is to download the image from the dashboard and flash it on your board.

Another way would be to download the config.json from the dashboard(Add Device -> Advanced -> Download configuration file only) and replace the config.json file from your boot partition with the downloaded file.

Regards!

Hi, @spanceac

I need to register my device without dashboard, but using a code.

So when we press Download Config button on dashboard, it will just call a API to compose config.json?
Could you please share the details of how config.json is created?

And do I have to reboot my RPi after replacing config.json in /boot/ directory?

Cheers,
Shane.

Hi,

The downloaded <app_name>.config.json file will instruct the device to register onto that application.

I’m not familiar with how the <app_name>.config.json is created, but I know that it works.

I usually do this step when I’m doing my own custom builds for development and not downloading them from the dashboard.

So download the <app_name>.config.json and replace config.json from the resin-boot partition of SD card before putting the card into the board.
It’s important that the name on the partition will be config.json and not <app_name>.config.json.

Boot the board and you will see it appear in the dashboard.

Note: this partition is mounted in the /mnt/boot path on the board and not /boot.

I’m assuming you use a RPi device. Please let us know what device you are actually using.

Regards!

Hi, @spanceac
Yeah, I am using an RPi 3B! :slight_smile:

Okay, I will give it a try tomorrow morning early. Thanks!

Cheers,
Shane.