From bc79de133e103500be1d765436d9f9bcc5fc7615 Mon Sep 17 00:00:00 2001 From: znetsixe Date: Sat, 23 May 2026 15:29:39 +0200 Subject: [PATCH] fix(influx): accept tagCode camelCase and emit positionVsParent tag The asset config standardised on tagCode (camelCase) but the InfluxDB tag emitter still read the lowercase tagcode, so any node saved through the new editor silently emitted tags.tagcode: undefined. Read both spellings so old + new configs both produce the tag. Also surfaces functionality.positionVsParent as a tag so dashboards can filter by upstream/downstream side. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/helper/outputUtils.js | 3 ++- test/output-utils.test.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helper/outputUtils.js b/src/helper/outputUtils.js index bf24246..5d7f24f 100644 --- a/src/helper/outputUtils.js +++ b/src/helper/outputUtils.js @@ -104,9 +104,10 @@ class OutputUtils { // functionality properties softwareType: config.functionality?.softwareType, role: config.functionality?.role, + positionVsParent: config.functionality?.positionVsParent, // asset properties (exclude machineCurve) uuid: config.asset?.uuid, - tagcode: config.asset?.tagcode, + tagcode: config.asset?.tagCode || config.asset?.tagcode, geoLocation: config.asset?.geoLocation, category: config.asset?.category, type: config.asset?.type, diff --git a/test/output-utils.test.js b/test/output-utils.test.js index 1824940..144c550 100644 --- a/test/output-utils.test.js +++ b/test/output-utils.test.js @@ -8,7 +8,7 @@ const config = { general: { id: 'abc', unit: 'mbar' }, asset: { uuid: 'u1', - tagcode: 't1', + tagCode: 't1', geoLocation: { lat: 51.6, lon: 4.7 }, category: 'measurement', type: 'pressure', @@ -38,5 +38,6 @@ test('influx format flattens tags and stringifies tag values', () => { assert.equal(msg.payload.measurement, 'measurement_abc'); assert.equal(msg.payload.tags.geoLocation_lat, '51.6'); assert.equal(msg.payload.tags.geoLocation_lon, '4.7'); + assert.equal(msg.payload.tags.tagcode, 't1'); assert.ok(msg.payload.timestamp instanceof Date); });