telefonicaid / telefonicaid/iotagent-node-lib
Autoprovision functionality not working as expected when configured at device/group level
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 62
- Forks
- 90
- Avg merge
- 2h 35m
- Merged PRs (30d)
- 1
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:
https://github.com/telefonicaid/iotagent-node-lib/blob/8a6cbd1a8d4023f239195f1aa1534c75a487f139/lib/services/ngsi/entities-NGSI-v1.js#L243-L249
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
) {
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/services/ngsi/entities-NGSI-v1.js around lines 243-249 and reproduce the device-level autoprovision request with the temperature and humidity measurements shown. Verify that the configured autoprovision behavior creates humidity in the Orion entity and that the measurement no longer returns HTTP 404, while temperature continues to update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100