Pre-install the iottlyAgent on the devies

The iottlyAgent can be preinstalled on the image of the devices, to allow for preparing the devices in bulk in a production environment. The procedure consists of two main steps:

  1. add the iottly agent to the image of your device
  2. register the device and connect it to iottlyCloud
    • this step is performed automatically via the self register procedure

Add the iottly agent to the image of your device

Follow these steps:

1. download the agent tarball

2. extract the tarball

Extract the tarball in a suitable path within your image (let say in /opt)

3. Create the file registersettings.json

Create the file /opt/iottly.com-agent/etc/iottly/registersettings.json with the following content

{
    "REGISTRATION_HOST": "api.cloud.iottly.com",
    "PROJECT_ID": "<project id>",
    "API_KEY": "<api key>",
    "DEVICE_NAME_HOOK":"<dynamic device name hook>",
    "DEVICE_NAME": "<fixed device name>",
    "REGISTRATION_PROTOCOL": "https"
}

The meaning of the keys is the following:

4. configure iottly to be started by the init system

Configure the init system of the image to run the following command: /opt/iottly.com-agent/sbin/iottly

This script handles the respawn, so that you don’t need to configure the init system to respawn the agent.

5. flash the image and turn on the device

The image built in this way has no dependencies on specific device attributes, so that you can use it as a master image to be flashed in bulk on new devices.

Once the device will be powered on the agent will start trying to register to iottlyCloud. As soon as an internet connection will be available for the device, the registration will succeed, and you’ll be able to see the device registered and connected in the DEVICE CONFIGURATION panel.