Registering devices at scale

How to register devices at scale

The next guide can help you install Connect 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 Connect Agent installed inside it.
  1. 1.
    Install Connect agent on a single device and make sure the device has been registered at the dashboard.
  2. 2.
    Disconnect the device from the internet.
  3. 3.
    Delete the file: /etc/connect/service/settings.json
  4. 4.
    Create a new file: /etc/connect/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 Connect dashboard at the Settings 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 Connect dashboard at the Settings category under the Project tab.
  5. 5.
    Save the file (from now on, don't connect the device to the internet until duplicating the image).
  6. 6.
    Duplicate this device image, and burn it on other SD cards or eMMC flashes.
  7. 7.
    Boot a new device with the duplicated image, Connect 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 Connect REST API - change devices details.
By using Connect 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/connect/service/settings.json with the values of the keys device_name and device_group. Make sure the group you set exists on Connect dashboard.
By default, if no device name or group have been defined, Connect 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/connect/service/ConnectAgent --print-token

Explanation of Connect device registration algorithm

By default, Connect is capable of registering new devices by duplicating an image that has Connect agent installed inside it. Connect device registration algorithm recognizes new devices 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.