This section contains instructions on how to configure migration tool and use it to export end devices from ChirpStack v4, that can later be imported in The Things Stack. This is a base for migrating end devices from ChirpStack to The Things Stack.
This guide covers migration from ChirpStack v4. For ChirpStack v3 , see the corresponding guide.
Configuration
First, configure the environment with the following variables modified according to your setup. Navigate to the folder where you installed ttn-lw-migrate
and execute:
$ export CHIRPSTACK_API_URL="localhost:8080" # ChirpStack Application Server URL
$ export CHIRPSTACK_API_KEY="eyJ0eX........" # Generate from ChirpStack GUI
$ export JOIN_EUI="0101010102020203" # JoinEUI for exported devices
$ export FREQUENCY_PLAN_ID="EU_863_870" # Frequency Plan for exported devices
$ export CHIRPSTACK_EXPORT_SESSION="true" # Set to true for session migration.
If using Windows OS, replace export
with set
and remove the double-quotes in commands above. For example, you would use:
set CHIRPSTACK_API_TOKEN=7F0as987e61...
JoinEUI
and FrequencyPlanID
have to be set because ChirpStack does not store these variables. See Frequency Plans for a full list of frequency plans supported by The Things Stack (and their IDs).
- ABP devices without an active session are successfully exported from ChirpStack, but cannot be imported into The Things Stack.
- MaxEIRP may not be always set properly.
- ChirpStack payload formatters also accept a
variables
parameter. This will always benull
on The Things Stack. - ChirpStack v4 uses UUIDs as application ID. The migration tool uses the appends the last index of the UUID to application ID.
- Ex: If the ChirpStack v4 application ID is
59459ffa-bfd3-4ef3-9cee-e1ca219397f2
, the tool generateschirpstack-e1ca219397f2
as the application ID.
- Ex: If the ChirpStack v4 application ID is
You can now proceed to exporting devices or applications.
Export Devices and Applications
To export a single end device to a devices.json
file based on their DevEUI
:
ttn-lw-migrate chirpstack device "0102030405060701" > devices.json
To export multiple end devices, create a devices.txt
file containing one DevEUI
per line:
0102030405060701
0102030405060702
0102030405060703
0102030405060704
0102030405060705
0102030405060706
To export multiple end devices to a devices.json
file:
ttn-lw-migrate chirpstack device < devices.txt > devices.json
To export end devices from a single application using its name (from ChirpStack):
ttn-lw-migrate chirpstack application "app1" > applications.json
To export end devices from multiple applications to an applications.json
file, you need to create a .txt
file containing one application name per line and run the following command in your terminal:
ttn-lw-migrate chirpstack application < applications.txt > applications.json
Warning:
ABP end devices without an active session can be exported from ChirpStack, but cannot be imported in The Things Stack.Please note that MaxEIRP
parameter may not be always set properly, and that the ChirpStack variables
parameter related to payload formatting will always be converted to null
when the end device is imported to The Things Stack.
After exporting, devices and applications can be imported in The Things Stack. See add end devices in bulk in The Things Stack for details about importing devices.