How to select OTAA/ABP and set DevEUI when creating device using TTN Python SDK?


I have been able to successfully create a new device using The Things Network Python SDK, but have to chose activation method manually (ABP/OTAA) and add device EUI manually in the ttn panel online.

Has anyone been able to create a new device using the SDK, specifying activation method and device EUI?


1 Like

Bump :slight_smile:

@htdvisser ? @arjanvanb ?

Would be nice to be able to do this, since it would automate much of the labour when creating new devices if you for some reason need to create many devices.

For example:

  1. Use the SDK to create a new device with the unique device adress, specify OTAA/ABP etc.
  2. Use the SDK to obtain the app keys and save this to a config file which is uploaded to the device.



I have try to create devices into an application using HTTP requests.
I have copy the example from the documentation and change the appID and devID.

{“altitude”:0,“app_id”:“apa_capture_rongeurs”,“attributes”:{“key”:"",“value”:""},“description”:“Some description of the device”,“dev_id”:“toad123”,“latitude”:52.375,“longitude”:4.887,“lorawan_device”:{“activation_constraints”:“local”,“app_eui”:“0102030405060708”,“app_id”:“apa_capture_rongeurs”,“app_key”:“01020304050607080102030405060708”,“app_s_key”:“01020304050607080102030405060708”,“dev_addr”:“01020304”,“dev_eui”:“0102030405060708”,“dev_id”:“toad123”,“disable_f_cnt_check”:false,“f_cnt_down”:0,“f_cnt_up”:0,“last_seen”:0,“nwk_s_key”:“01020304050607080102030405060708”,“uses32_bit_f_cnt”:true}}

When we POST a JSON payload on the URL[1], we get some very generic message (Metadata not valid: neither token nor key present) that do not help us to find a solution.

Can you provide a valid example to create a device into an application ?
Does the TTStack v3 API can be use with TTN ?
Can i use the ttn-lw-cli to create device on TTN ?