The Things Stack has support for importing end devices from CSV (comma-separated values) files.
This method is useful when batches of end devices are managed in Microsoft Excel or any other spreadsheet or database that can export to CSV file.
The CSV import in The Things Stack uses the following settings:
- Semicolon (
;
) as field delimiter. This makes working with Microsoft Excel and other spreadsheets convenient - Header row is required
- On each row, the same number of fields as on the header line
- Use quotes to use
;
in a field value - Use double quotes to escape quotes
- Unknown header columns are permitted and ignored
The following columns are recognized:
Column | Required | Alias | Format | Meaning |
---|---|---|---|---|
dev_eui |
Yes | Hexadecimal string | LoRaWAN® DevEUI | |
join_eui |
Yes | app_eui |
Hexadecimal string | LoRaWAN JoinEUI (or AppEUI) |
id |
No | Alphanumeric string, lowercase with hyphens | Device ID (falls back to DevEUI if not set) | |
name |
No | Free form | Name | |
description |
No | string | Optional, description of the device | |
lorawan_version |
No * | See MACVersion |
LoRaWAN version | |
lorawan_phy_version |
No * | See PHYVersion |
LoRaWAN Regional Parameters version | |
frequency_plan_id |
No * | See Frequency Plans | Frequency plan ID | |
brand_id |
No | Vendor ID string from Device Repository | Device brand ID | |
model_id |
No | Model ID from Device Repository | Device model ID | |
firmware_version |
No | Firmware version from Device Repository | Firmware version | |
hardware_version |
No | Hardware version from Device Repository | Hardware version | |
band_id |
No | See Frequency Plans | LoRaWAN Band ID | |
supports_class_c |
No | boolean | true for Class C devices, false otherwise. |
|
app_key |
Yes | Hexadecimal string | LoRaWAN AppKey | |
nwk_key |
No | Hexadecimal string | LoRaWAN NwkKey | |
rx1_delay |
No | string | Delay for the first Class A receive window (Rx1). Typical values are "RX_DELAY_1" (1 second) and "RX_DELAY_5" (5 seconds). See MACSettings for more information. |
|
supports_32_bit_f_cnt |
No | boolean | true if device supports 32-bit frame counters, false if device only supports 16-bit frame counters. |
|
dev_addr |
For existing session | Hexadecimal string | Needed for ABP devices or when migrating OTAA devices with an existing session. See Device Address for more information. | |
app_s_key |
For existing session | string | Needed for ABP devices or when migrating OTAA devices with an existing session. See Application Session Key for more information. | |
f_nwk_s_int_key |
For existing session | string | Forwarding Network Session Integrity Key, also referred to as Network Session Key in LoRaWAN v1.0.x compatibility mode. See SessionKeys and Forwarding Network Session Integrity Key for more information. | |
last_f_cnt_up |
For existing session | uint | Last uplink frame counter used. | |
last_n_f_cnt_down |
For existing session | uint | Last network downlink frame counter used. | |
last_a_f_cnt_down |
For existing session | uint | Last application downlink frame counter used. |
* If you don’t set this, you must set the fallback value when importing the CSV file. See Importing devices.
Example
Minimal example:
dev_eui;join_eui;frequency_plan_id;lorawan_version;lorawan_phy_version;app_key
1111111111111111;1111111111111111;EU_863_870_TTN;MAC_V1_0_4;RP002_V1_0_3;11111111111111111111111111111111
2222222222222222;2222222222222222;EU_863_870_TTN;MAC_V1_0_4;RP002_V1_0_3;22222222222222222222222222222222
3333333333333333;3333333333333333;EU_863_870_TTN;MAC_V1_0_4;RP002_V1_0_3;33333333333333333333333333333333
All columns for a LoRaWAN 1.0.4 device:
id;dev_eui;join_eui;name;frequency_plan_id;lorawan_version;lorawan_phy_version;brand_id;model_id;hardware_version;firmware_version;band_id;app_key
test-one;1111111111111111;1111111111111111;Device 1;EU_863_870_TTN;MAC_V1_0_4;RP002_V1_0_3;the-things-industries;generic-node-sensor-edition;1.0.4;1.0;EU_863_870;11111111111111111111111111111111
test-two;2222222222222222;2222222222222222;Device 2;EU_863_870_TTN;MAC_V1_0_4;RP002_V1_0_3;the-things-industries;generic-node-sensor-edition;1.0.4;1.0;EU_863_870;22222222222222222222222222222222
test-three;3333333333333333;3333333333333333;Device 3;EU_863_870_TTN;MAC_V1_0_4;RP002_V1_0_3;the-things-industries;generic-node-sensor-edition;1.0.4;1.0;EU_863_870;33333333333333333333333333333333
Excel Template
Download the Excel template. You can remove all columns that are not required (see above).
To export for The Things Stack, go to File, Save As and select Comma Separated Values as file format.