diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 2673b6173..919612c39 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ - Fix: include entity id and entity type as measure value when measure is an ngsi (both NGSIv2 and NGSI-LD) payload + diff --git a/docs/usermanual.md b/docs/usermanual.md index 806ce3876..d1754772e 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -171,7 +171,6 @@ Examples of these `ngsiv2` payloads are the following ones: } ``` - Example of these `ngsild` payloads are the following ones: (1) NGSI-LD entities array format: @@ -212,7 +211,7 @@ Example of these `ngsild` payloads are the following ones: }, ... ] -```` +``` (2) NGSI-LD single entity format: diff --git a/lib/commonBindings.js b/lib/commonBindings.js index d9cef39d5..44b5d94b3 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -115,9 +115,10 @@ function extractAttributes(device, current, payloadType) { for (const k in entity) { if (entity.hasOwnProperty(k)) { if (['id', 'type'].includes(k)) { - // Include ngsi id and type as measures + // Include ngsi id and type as measures by inserting here as is + // and later in iota-node-lib sendUpdateValueNgsi2 rename as measure_X valuesEntity.push({ - name: constants.NGSI + k, + name: k, type: guessType(k, device, null), value: entity[k] }); diff --git a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json index ac54337e9..3d7965f15 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json @@ -1,11 +1,11 @@ { "id": "Second MQTT Device", "type": "AnMQTTDevice", - "ngsi_id": { + "measure_id": { "type": "string", "value": "urn:ngsi-ld:ParkingSpot:santander:daoiz_velarde_1_5:3" }, - "ngsi_type": { + "measure_type": { "type": "string", "value": "ParkingSpot" }, diff --git a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json index 5b0acbff8..6dd1c3d4a 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json +++ b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json @@ -1,11 +1,11 @@ { "id": "Second MQTT Device", "type": "AnMQTTDevice", - "ngsi_id": { + "measure_id": { "type": "string", "value": "urn:ngsi-ld:ParkingSpot:santander:reyes_magos_1_1:1" }, - "ngsi_type": { + "measure_type": { "type": "string", "value": "ParkingSpot" }, diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json index 990dd2d93..7b9762346 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json @@ -1,11 +1,11 @@ { "id":"Second MQTT Device", "type":"AnMQTTDevice", - "ngsi_id": { + "measure_id": { "type": "string", "value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-2" }, - "ngsi_type": { + "measure_type": { "type": "string", "value": "Streetlight" }, diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json index ee1285330..49fdc2639 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json @@ -1,11 +1,11 @@ { "id": "Second MQTT Device", "type": "AnMQTTDevice", - "ngsi_id": { + "measure_id": { "type": "string", "value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-3" }, - "ngsi_type": { + "measure_type": { "type": "string", "value": "Streetlight" },