Connecting devices at scale
How to register devices at scale
The next guide can help you install Upswift on a fleet of devices easily without the need to register each device manually.
Using this guide you will be able to register devices by duplicating an existing OS image that has the Upswift Agent installed inside it.
Install Upswift agent on a single device and make sure the device has been registered at Upswift dashboard.
Disconnect the device from the internet.
Delete the file:
/etc/upswift/service/settings.json
Create a new file:
/etc/upswift/service/settings.json
and enter the next content to it:{"user_token":"<user_token>", "project_name":"<project_name>", "device_name":"", "device_group":"", "software_version":"", "device_token":""}
Make sure to change the<user_token>
to your account token. You can find it on Upswift dashboard at theSettings
category (click on the "Show Account Token
" button). Also change the<project_name>
to the project you want this device to be registered to. You can find your projects on Upswift dashboard at theSettings
category under theProject
tab.Save the file (from now on, don't connect the device to the internet until duplicating the image).
Duplicate this device image, and burn it on other SD cards or eMMC flashes.
Boot a new device with the duplicated image, Upswift agent will automatically recognize that it is running on new hardware and will register that device as a new device.
Set custom device name and group automatically
Option A The device name and group can be changed using Upswift REST API - change devices details.
By using Upswift REST API, the device can run a script to change the name and group after device registration.
Option B
You can set the default group and device name by modifying the settings.json
file. Before the device registers to the platform, you can modify the file /etc/upswift/service/settings.json
with the values of the keys device_name
and device_group
. Make sure the group you set exists on Upswift dashboard.
By default, if no device name or group have been defined, Upswift will register the device with a generic name - New device
to the group Production
.
Please note! After the device registers to the platform, the settings.json file is encrypted and you will not be able to modify it anymore. To receive the device token, you can run the agent binary with the flag --print-token.
The command is:/etc/upswift/service/UpswiftAgent --print-token
Explanation of Upswift device registration algorithm
By default, Upswift is capable of registering new devices by duplicating an image that has Upswift agent installed inside it. Upswift device registration algorithm recognizes new device if they don't have a device token yet. The device token is generated when the device registers for the first time and is saved encrypted in the settings.json
file on the device.
Last updated