-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
Issue: Autoprovision functionality not working as expected when configured at device/group level.
Steps to reproduce:
- Register a device with 'autoprovision' flag set to true:
{
"devices": [
{
"device_id": "sensor001",
"entity_name": "urn:ngsi-ld:Sensor:sensor001",
"entity_type": "Sensor",
"timezone": "Europe/Berlin",
"attributes": [
{ "object_id": "temperature", "name":"temperature", "type":"number"}
],
"autoprovision":true
}
]
}
- Send measurement for this device with an extra measurement attribute. Sample measurement payload:
{
"temperature":23.4,
"humidity":40
}
Expected result: As "autoprovision" is "true" for this device, the new attribute "humidity" should get created in the Orion entity with its measurement value.
Actual result: "humidity" attibute is not getting created in Orion entity. HTTP status code 404 is returned. (Note: Measurement of "temperature" is getting updated in Orion though.)
I've identified potential cause of the issue:
iotagent-node-lib/lib/services/ngsi/entities-NGSI-v1.js
Lines 243 to 249 in 8a6cbd1
| if ( | |
| 'autoprovision' in typeInformation && | |
| /* jshint -W101 */ | |
| typeInformation.autoprovision === undefined | |
| ? typeInformation.autoprovision === true | |
| : config.getConfig().appendMode === true | |
| ) { |
Below fix is required (line# 246)
if (
'autoprovision' in typeInformation &&
/* jshint -W101 */
typeInformation.autoprovision !== undefined //This should be !== operator and not ===
? typeInformation.autoprovision === true
: config.getConfig().appendMode === true
) {
Metadata
Metadata
Assignees
Labels
No labels