Hi
I have added a few hundred devices into our FIWARE installation. Unfortunately, I have just found an issue that could prove problematic for us.
To provision a device, following the format I got from the tutorial an example, my JSON looks similar to (including the important actual device_id):
{
"devices": [
{
"device_id": "O071_EL_CONS",
"entity_name": "urn:ngsi-ld:Electricity:0001",
"entity_type": "ElectricityDemand",
"timezone": "Europe/Stockholm",
"attributes": [
{ "object_id": "timestamp", "name": "timestamp", "type": "DateTime" },
{ "object_id": "value", "name": "value", "type": "Number" }
],
"static_attributes": [
{ "name":"description", "type": "Text", "value": "Consumption at building"},
{ "name":"unit", "type": "Text", "value": "KWh"},
{ "name":"controlStatus", "type": "Text", "value": "meter"},
{ "name":"deviceType", "type": "Text", "value": "demand"}
]
}
]
}'
However, when testing trying to GET data from the Orion context broker using the device_id specifically it fails:
curl -X GET 'http://localhost:1026/v2/entities?id=O071_EL_CONS' -H 'fiware-service: building' -H 'fiware-servicepath: /country/city/building/electricity'
[]
So, I went looking in the mongo backend and find that the device_id is a field in the iotagentjson->devices document, but completely missing from the orion-building-> entities document:
{
_id: {
id: 'urn:ngsi-ld:Electricity:0001',
type: 'ElectricityDemand',
servicePath: '/country/city/building/electricity'
},
attrNames: [
'timestamp',
'value',
...
This is problematic as it is likely we will want to retrieve data using the device_id for integration purposes.
As it's possible when provisioning a device directly in the IoT agent to store the entity_name and entity_type in the Orion context broker entity, then it should be possible to also store the device_id in Orion in order to reduce the amount of extra code/lookup tables needing to be written to handle this.
I considered creating a static_attribute to contain the device_id in the meantime - however, I haven't been able to figure out how to retrieve data using the Orion API by only an attribute value (ie without relying on the entity name, and https://swagger.lab.fiware.org/ would suggest I can't.
Is extra code using some kind of lookup tables the only way for me at this point to map the actual device ID with the entity ID?
I wanted to mention about the inconsistency with naming having been confusing during my learning curve - especially with regard to the entity ID:
* JSON provisioning a device: entity_name
* mongo->orion-*->entities: id
* mongo->iotagentjson->devices: name
* swagger spec: entityID
* GET request: id (making it confusing when attempting to get data using the device_id)
Anyway, I would be very grateful if you can advice with my device ID problem.
Kind regards
Taz
Kind regards
Taz Lodder
Chalmers University of Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-tech-help/attachments/20210602/b351a3c6/attachment.html>
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy