ThingsBoard provides the option of bulk provisioning using the CSV file for the following types of entities:
Different entities may have the following parameters:
To create multiple entities at one time, you need to create a CSV file, where each line will be responsible for creating one entity with given parameters.
If you don’t need to add some settings for a particular entity, leave this cell empty.
There are three reserved parameters names: Name, Type and Label that have a predefined column type.
Upload a CSV file to the system.
For the uploaded file you need to configure the following parameters::
At this step, you need to define a match between the columns of the downloaded file and the type of data in the ThingsBoard platform. You can also set/change the default name for attribute/telemetry key.
Processing input data.
The result of the query execution: the number of created/updated entities and the number of errors that occurred during execution.
Let’s suppose we want to create at the same time 10 devices and give them an access token.
Note: file should contain at least two columns: entity name and type.
File was created using the CSV file editor, it contains data for 10 devices. Also, the Data2 parameter was omitted for Device 5, it will not be created for this device.
Go to Devices -> Import device
Upload sample file: test-import-device.csv
The first column of the table displays the first file line that contains data.
Since the First line contains column names checkbox has been set on the previous step, values for the third column have already been initiated based on the first line of the document.
Let’s change some of the attributes. Change the column type in the third row to Timeseries and set the attribute/telemetry key value, for example, Temperature.
The last row in the following table is responsible for the token so change Server attribute to Access token.
Note: such column types as Name, Type and Access token can be selected only for one row.
After the creation process was completed, some statistics information will be shown.
On the following example, we can see that 8 devices were created successfully, and an error occurred while creating 2 devices. The reason is that Device 1, Device 2 and Device 3 have the same token in the given sample file. ThingsBoard system prohibits that.