We have a FIWARE based architecture that uses the IoT Agent for a JSON based protocol.
We have a sensor that sends measures, whose format is already NGSI.
I thought the behavior of the agent was to recognize the NGSI format and manipulate the data so that the final result is correct.
Instead, the current result is that the value on Orion becomes the full NGSI.
e.g.
Attribute on Orion Entity:
"altitude": {
"type": "number",
"value": "12",
"metadata": {
"TimeInstant": {
"type": "ISO8601",
"value": "2019-10-16T09:01:40.460Z"
}
}
}
Send:
{
"altitude": {
"value": "22"
}
}
Result:
"altitude": {
"type": "number",
"value": {
"value": "22"
},
"metadata": {
"TimeInstant": {
"type": "ISO8601",
"value": "2019-10-16T09:08:50.307Z"
}
}
}
Is it correct ?
The purpose of the IOTA (well, one of them :) is to translate measures send by the device to NGSI information at Context Broker. Thus, at device-IOTA level the device sends:
{ <measure_name>: <measure_value> }
So the IOTA looks for the attribute corresponding to <measure_name>
(which, in the case no mapping exists, corresponds with just <measure_name>
) and update its value with <measure_value>
.
In your example, I understand <measure_name>
is "altitude"
and the <measure_value>
is a JSON object { "value": "22" }
. I understand also you don't have measure-attribute mapping in place, so the name of the attribute at Context Broker is "altitude"
, which receives an update with value { "value": "22" }
.
So everything seems to be normal, although maybe what you want is to send "22"
as value at device-IOTA interface instead of { "value": "22" }
.