Hello,
I’m currently writing a python script for bulk-provisioning MCCI Catena 4610 Boards. When I’m creating end devices with the API, Everything works fine except that the network and application layer can’t be expanded in the devices general settings. It gives me an error trying to do so that says: “An unknown error occurred. Please try again later. If the error persists, please contact support.
We’re sorry for the inconvenience.”
Also Frequency Plan, Regional Parameter version and lorawan version says “n/a”.
My code for registering devices currently looks like this:
add_device_data = {
"end_device": {
"ids": {
"device_id": device_id,
"application_ids": {
"application_id": app_id
},
"dev_eui": deveui,
"join_eui": "0000000000000000"
},
"created_at": datetime.now().isoformat() + "Z",
"updated_at": datetime.now().isoformat() + "Z",
"name": f"Device named",
"lorawan_version": "MAC_V1_0_3",
"lorawan_phy_version": "RP001_V1_0_3_REV_A",
"frequency_plan_id": "EU_863_870_TTN",
"attributes": {},
"version_ids": {
"brand_id": "mcci",
"model_id": "catena4610",
"hardware_version": "_unknown_hw_version_",
"firmware_version": "0.2.0",
"band_id": "EU_863_870_TTN"
},
"network_server_address": "eu1.cloud.thethings.network",
"application_server_address": "eu1.cloud.thethings.network",
"join_server_address": "eu1.cloud.thethings.network",
"supports_join": True,
"root_keys": {
"app_key": {
"key": appkey
},
"mac_settings": {
"supports_32_bit_f_cnt": True
},
"formatters": {
"up_formatter": "FORMATTER_REPOSITORY",
"down_formatter": "FORMATTER_REPOSITORY"
}
},
},
"field_mask": {
"paths": [
"ids.device_id",
"ids.dev_eui",
"ids.join_eui",
"lorawan_version",
"lorawan_phy_version",
"frequency_plan_id",
"root_keys.app_key.key",
"version_ids.brand_id",
"version_ids.model_id",
"version_ids.hardware_version",
"version_ids.firmware_version",
"version_ids.band_id"
]
}
}
url = f"https://eu1.cloud.thethings.network/api/v3/applications/{app_id}/devices"
try:
response = requests.post(url, json=add_device_data, headers=headers)
if response.status_code == 200:
print("Devices registered successfully!")
if x is amount-1:
messagebox.showinfo("Success", "Devices Added Successfully")
data = response.json()
else:
print(f"Error registering device: {response.text}")
messagebox.showerror("Error", f"Error registering device: {response.text}")
except requests.RequestException as e:
print(f"An error occurred during registration: {e}")
messagebox.showerror("Error", f"An error occurred during registration: {e}")
Console says:
send: b'POST /api/v3/applications/testsemifinal/devices HTTP/1.1\r\nHost: eu1.cloud.thethings.network\r\nUser-Agent: python-requests/2.31.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nAuthorization: Bearer NNSXS.QQNSHPRPR6E5PSM6ZZQIHEOB65AYALTBZFZLVRA.JSC2UE6RJRMHL5OVH44KZMS57JCUHF2Q7R7VD4EKBUORQHWQNK7A\r\nContent-Type: application/json\r\nContent-Length: 1259\r\n\r\n'
send: b'{"end_device": {"ids": {"device_id": "3c8bfe18-b6e0-4b4f-901b-9dc2419b15f5", "application_ids": {"application_id": "testsemifinal"}, "dev_eui": "198127f91f154feb", "join_eui": "0000000000000000"}, "created_at": "2024-01-26T16:30:54.607511Z", "updated_at": "2024-01-26T16:30:54.607511Z", "name": "Device named", "lorawan_version": "MAC_V1_0_3", "lorawan_phy_version": "RP001_V1_0_3_REV_A", "frequency_plan_id": "EU_863_870_TTN", "attributes": {}, "version_ids": {"brand_id": "mcci", "model_id": "catena4610", "hardware_version": "_unknown_hw_version_", "firmware_version": "0.2.0", "band_id": "EU_863_870_TTN"}, "network_server_address": "eu1.cloud.thethings.network", "application_server_address": "eu1.cloud.thethings.network", "join_server_address": "eu1.cloud.thethings.network", "supports_join": true, "root_keys": {"app_key": {"key": "f73ea92227a4d9bb219c3512e81a0c85"}, "mac_settings": {"supports_32_bit_f_cnt": true}, "formatters": {"up_formatter": "FORMATTER_REPOSITORY", "down_formatter": "FORMATTER_REPOSITORY"}}}, "field_mask": {"paths": ["ids.device_id", "ids.dev_eui", "ids.join_eui", "root_keys.app_key.key", "version_ids.brand_id", "version_ids.model_id", "version_ids.hardware_version", "version_ids.firmware_version", "version_ids.band_id"]}}'
reply: 'HTTP/1.1 200 OK\r\n'
Picture of Device not having parameters: