This section contains instructions on how to configure migration tool and use it to export end devices from Firefly, that can later be imported in The Things Stack.
Before you begin
- Using the actual JoinEUI of the end devices is mandatory when registering them on The Things Stack. Since Firefly does not store the JoinEUI of the device, users need to obtain this information separately, such as from the device manufacturer.
- The export process will halt if any error occurs.
- Use the
--invalidate-keys
option to invalidate the root and/or session keys of the devices on the Firefly server. This is necessary to prevent both networks from communicating with the same device. The last byte of the keys will be incremented by 0x01. This enables an easy rollback if necessary. Setting this flag to false (default) would result in a “dry run”, where the devices are exported but they will still be able to communicate with the Firefly server.
Configuration
Configure with environment variables, or command-line arguments.
See ttn-lw-migrate firefly {device|application} --help
for more details.
The following example shows how to set options via environment variables. These are example values. Please use actual ones based on your case.
$ export FIREFLY_HOST=example.com # Host of the Firefly API
$ export FIREFLY_API_KEY=abcdefgh # Firefly API Key
$ export APP_ID=my-test-app # Application ID for the exported devices
$ export JOIN_EUI=1111111111111111 # JoinEUI for the exported devices.
$ export FREQUENCY_PLAN_ID=EU_863_870 # Frequency Plan ID for the exported devices
$ export MAC_VERSION=1.0.2b # LoRaWAN MAC version for the exported devices
The above settings are common for all the following export methods.
Export Devices
To export a single device using its Device EUI (e.g. 1111111111111112
):
# dry run first, verify that no errors occur
$ ttn-lw-migrate firefly device 1111111111111112 --verbose > devices.json
# export device
$ ttn-lw-migrate firefly device 1111111111111112 --invalidate-keys > devices.json
In order to export a large number of devices, create a file named device_euis.txt
with one device EUI per line:
1111111111111112
FF11111111111134
ABCD111111111100
Please note that all these devices should have the same JoinEUI.
And then export with:
# dry run first, verify that no errors occur
$ ttn-lw-migrate firefly device --verbose < device_ids.txt > devices.json
# export devices
$ ttn-lw-migrate firefly device --invalidate-keys < device_ids.txt > devices.json
The Firefly LNS does not strictly enforce device to application relationships.
Setting the --all
flag will export all devices that are accessible by the API key.
The application
command without the --all
flag is a no-op (does nothing).
Note: Please be cautious while using this command as this might invalidate all the keys of all the devices.
To export all devices accessible by the API Key,
# dry run first, verify that no errors occur
$ ttn-lw-migrate firefly application --all --verbose > devices.json
# export all devices
$ ttn-lw-migrate firefly application --all --invalidate-keys > devices.json
After exporting, devices can be imported in The Things Stack. See add end devices in bulk in The Things Stack for details about importing devices.