iotagent-node-lib
iotagent-node-lib copied to clipboard
Sending observations from a device associated to an entity with ambiguity in the type
As the uniqueness in the CB is defined by "entitiy_id" and "entity_type" we can have the following entities:
<service, subservice, entity_1, type_A>
<service, subservice, entity_1, type_B>
For this situation we need to use the "type" as URL parameter to distinguish the entity when we make requests to the CB.
Example: https://host/v2/entities/entity_1?type=type_A
Then we create a device associate to an entity with this kind ambiguity, for example:
{
"devices": [
{
"device_id": "tempSensorWSN_A",
"entity_name": "entity_1",
"entity_type": "type_A",
"attributes": [
{ "object_id": "t", "name": "temperature", "type": "float" },
{ "object_id": "h", "name": "humidity", "type": "float" }
],
"protocol": "IoTA-UL",
"transport": "HTTP"
}
]
}
the creation is correct but when we try to send observations through the IoTA (UL2.0 is what I tested), the answer is:
{
"name": "ENTITY_GENERIC_ERROR",
"message": "Error accesing entity data for device: entity_1 of type: type_A"
}
It seems like the IoTA does not add the type paramenter to the URL when create the request to the CB as is needed in these cases.
Partially fixed by PR #734
Pending entry (we forgot it in PR #734):
- Fix: add ?type parameter in CB request updates to avoid potential entity ambiguities (#733)
From https://github.com/telefonicaid/iotagent-node-lib/pull/734/files#r249474148, some modifications are pending before we can consider this issue as closed.
@dcalvoalonso will you take care of it at the end, please? Thanks!
Sure, no problem at all.
PR https://github.com/telefonicaid/iotagent-node-lib/pull/751 concludes the work at iotagent-node-lib
However, I'll keep this issue while IOTA-JSON and IOTA-UL test gets failing. @dcalvoalonso I can take care of it, although if I find difficulties maybe I'll ask help :)
Great! Thanks @fgalan !