telefonicaid / telefonicaid/iotagent-node-lib
API does not return device metadata (update metadata not working)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 62
- Forks
- 90
- Avg merge
- 2h 35m
- Merged PRs (30d)
- 1
Description
Hello,
I recognised that the endpoint to retrieve a device by id does not return the metadata added to attributes as documented
in the nodelib docs.
This happens although the metadata is correctly posted to the create endpoint and the referenced entity is correctly initialised:
How to reproduce:
I sent this payload to the create endpoint:
"devices": [
{
"device_id": "device_with_meta",
"service": null,
"service_path": "/",
"entity_name": "test_entity",
"entity_type": "test_entity_type",
"timezone": "Europe/Berlin",
"timestamp": null,
"apikey": "1234",
"endpoint": null,
"protocol": null,
"transport": "HTTP",
"lazy": [],
"commands": [],
"attributes": [
{
"name": "temperature",
"type": "Number",
"metadata": {
"accuracy": {
"type": "Text",
"value": "+-5%"
}
},
"expression": null,
"entity_name": null,
"entity_type": null,
"reverse": null,
"object_id": "temperature"
}
],
"static_attributes": [],
"internal_attributes": null,
"expressionLanguage": null,
"explicitAttrs": false,
"ngsiVersion": "v2"
}
]
The created then entity looks like this:
{
"id": "test_entity",
"type": "test_entity_type",
"TimeInstant": {
"type": "DateTime",
"value": "2021-05-06T07:34:20.417Z",
"metadata": {}
},
"temperature": {
"type": "Number",
"value": null,
"metadata": {
"accuracy": {
"type": "Text",
"value": "+-5%"
}
}
}
}
However, retrieving the device by its id returns this:
{
"device_id": "device_with_meta",
"service": "filip",
"service_path": "/testing",
"entity_name": "test_entity",
"entity_type": "test_entity_type",
"apikey": "1234",
"transport": "HTTP",
"lazy": [],
"commands": [],
"attributes": [
{
"name": "temperature",
"type": "Number",
"object_id": "temperature"
}
],
"static_attributes": [],
"explicitAttrs": false,
"ngsiVersion": "v2"
}
Am I missing an undocumented query parameter here or is it just a bug?
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 with the device creation and retrieve-by-ID API entry points described in the nodelib API documentation, then reproduce the request using the supplied payload. Compare the returned device attributes with the entity shown in the issue, focusing on whether metadata is dropped during retrieval. Done means the retrieve response includes the attribute metadata posted during creation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100