From 62affdbc83c1d3cdcc9ffb31be9b2e65478dc7ea Mon Sep 17 00:00:00 2001 From: E068097 Date: Thu, 14 Nov 2024 16:46:39 +0100 Subject: [PATCH] #2985 Batch import creates ABP tags in Device Twin for OTAA-based device models --- src/IoTHub.Portal.Server/Managers/ExportManager.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/IoTHub.Portal.Server/Managers/ExportManager.cs b/src/IoTHub.Portal.Server/Managers/ExportManager.cs index 16c63c4dc..267af1165 100644 --- a/src/IoTHub.Portal.Server/Managers/ExportManager.cs +++ b/src/IoTHub.Portal.Server/Managers/ExportManager.cs @@ -290,9 +290,15 @@ private async Task ImportLoRaDevice( TryReadProperty(csvReader, newDevice, c => c.AppKey, string.Empty); TryReadProperty(csvReader, newDevice, c => c.AppEUI, string.Empty); - TryReadProperty(csvReader, newDevice, c => c.AppSKey, string.Empty); - TryReadProperty(csvReader, newDevice, c => c.NwkSKey, string.Empty); - TryReadProperty(csvReader, newDevice, c => c.DevAddr, string.Empty); + if (string.IsNullOrEmpty(newDevice.AppKey) && string.IsNullOrEmpty(newDevice.AppEUI)) + { + // ABP Settings + TryReadProperty(csvReader, newDevice, c => c.AppSKey, string.Empty); + TryReadProperty(csvReader, newDevice, c => c.NwkSKey, string.Empty); + TryReadProperty(csvReader, newDevice, c => c.DevAddr, string.Empty); + newDevice.AppEUI = null; + newDevice.AppKey = null; + } TryReadProperty(csvReader, newDevice, c => c.GatewayID, string.Empty); TryReadProperty(csvReader, newDevice, c => c.Downlink, null); TryReadProperty(csvReader, newDevice, c => c.ClassType, ClassType.A);