@@ -34,6 +34,7 @@ const LoadConfig = require('./load-config')
34
34
const Redundancy = require ( './redundancy' )
35
35
const AutoTag = require ( './auto-tag' )
36
36
const { castSparkplugValue : castSparkplugValue } = require ( './cast' )
37
+ const autoTag = require ( './auto-tag' )
37
38
38
39
const SparkplugNS = 'spBv1.0'
39
40
const DevicesList = [ ] // contains either EoN nodes or devices
@@ -1406,6 +1407,15 @@ async function sparkplugProcess(
1406
1407
// match = true
1407
1408
}
1408
1409
1410
+ if (
1411
+ autoTag &&
1412
+ elem . endsWith ( '#' ) &&
1413
+ topic . startsWith ( elem . substring ( 0 , elem . length - 1 ) )
1414
+ ) {
1415
+ let JsonValue = TryPayloadAsRJson ( payload )
1416
+ EnqueueJsonValue ( JsonValue , topic )
1417
+ }
1418
+
1409
1419
// keep testing for match when JSONPathPlus syntax is used
1410
1420
if ( elem . indexOf ( '$.' ) === - 1 ) return
1411
1421
@@ -1445,18 +1455,6 @@ async function sparkplugProcess(
1445
1455
}
1446
1456
}
1447
1457
} )
1448
-
1449
- // if (match) return
1450
-
1451
- // // try to detect payload as JSON or RJSON
1452
-
1453
- // if (payload.length > 20000) {
1454
- // Log.log(logMod + 'Payload too big!')
1455
- // return
1456
- // }
1457
-
1458
- // let JsonValue = TryPayloadAsRJson(payload)
1459
- // EnqueueJsonValue(JsonValue, topic)
1460
1458
}
1461
1459
)
1462
1460
@@ -2299,13 +2297,13 @@ function EnqueueJsonValue(JsonValue, protocolSourceObjectAddress) {
2299
2297
}
2300
2298
2301
2299
if ( isNaN ( value ) ) value = 0
2302
- if ( JsonValue === null ) JsonValue = { }
2300
+ if ( JsonValue === null ) JsonValue = ""
2303
2301
2304
2302
ValuesQueue . enqueue ( {
2305
2303
protocolSourceObjectAddress : protocolSourceObjectAddress ,
2306
2304
value : value ,
2307
2305
valueString : valueString ,
2308
- valueJson : JsonValue ,
2306
+ valueJson : JSON . stringify ( JsonValue ) ,
2309
2307
invalid : false ,
2310
2308
transient : false ,
2311
2309
causeOfTransmissionAtSource : '3' ,
0 commit comments