diff --git a/lib/services/ngsi/entities-NGSI-v2.js b/lib/services/ngsi/entities-NGSI-v2.js index 4a0d89460..110e9c746 100644 --- a/lib/services/ngsi/entities-NGSI-v2.js +++ b/lib/services/ngsi/entities-NGSI-v2.js @@ -463,7 +463,7 @@ function sendUpdateValueNgsi2(entityName, originMeasures, originTypeInformation, } //remove measures that has been shadowed by an alias (some may be left and managed later) //Maybe we must filter object_id if there is name == object_id - measures = measures.filter((item) => item.name !== currentAttr.object_id && item.name !== currentAttr.name); + measures = measures.filter((item) => item.name !== currentAttr.object_id); if ( currentAttr.expression !== undefined && diff --git a/test/functional/testCases.js b/test/functional/testCases.js index b2f850aa5..26c31509a 100644 --- a/test/functional/testCases.js +++ b/test/functional/testCases.js @@ -542,6 +542,11 @@ const testCases = [ object_id: '.1.0.0.1', name: 'psBatteryVoltage', type: 'Number' + }, + { + object_id: 'f_dt', + name: 'fireDetectionThreshold', + type: 'Number' } ], static_attributes: [] @@ -588,6 +593,41 @@ const testCases = [ value: 23.5 } } + }, + { + shouldName: + 'A - WHEN sending defined measures by attribute names through http IT should send measures to Context Broker preserving value types, name mappings and metadatas', + type: 'single', + measure: { + url: 'http://localhost:' + config.http.port + '/iot/json', + method: 'POST', + qs: { + i: globalEnv.deviceId, + k: globalEnv.apikey + }, + json: { + a: false, + fireDetectionThreshold: 10 + } + }, + expectation: { + id: globalEnv.entity_name, + type: globalEnv.entity_type, + attr_a: { + value: false, + type: 'Boolean', + metadata: { + accuracy: { + value: 0.8, + type: 'Float' + } + } + }, + fireDetectionThreshold: { + type: 'Number', + value: 10 + } + } } ] },