Open IngMiad opened 3 months ago
Hello Inga,
the broker simply stores the values as they come in. It doesn't make any decisions, it just follows orders. In your case it seems like some values are compounds and others are not. If compound (Array or Object), they will be stored as Array or Object. If simple data type, then that way. I can only assume that that's what you're experiencing.
And, the broker is agnostic to data models. It only looks at the incoming payload body. If you provide those bodies, I would be able to explain this in more detail
Hello @kzangeli,
thank you for the response. I had time to investigate the incoming payloads using wireshark and the logs of the OPC UA IoT-Agent. The logs of the IoT-Agent seem to be more useful for investigation.
First data source with numeric values:
...
trans=5fe32dba-7267-4ff4-8276-31d875e3c7a7 | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Options: {
"url": "http://orion-ld:1026/ngsi-ld/v1/entityOperations/upsert/?options=update",
"method": "POST",
"headers": {
"fiware-service": "opcua_meteo",
"fiware-servicepath": "/weather",
"Content-Type": "application/ld+json",
"NGSILD-Tenant": "opcua_meteo",
"NGSILD-Path": "/weather"
},
"json": [
{
"@context": "http://ld-context/ld-context/datamodels.context-ngsild.jsonld",
"temperature": {
"type": "Property",
"value": 46252,
"observedAt": "2024-09-26T15:46:16.925Z"
},
"id": "urn:ngsi-ld:WeatherObserved:meteostation-01",
"type": "WeatherObserved"
}
]
} | comp=IoTAgent
...
Second data source with compound values:
...
trans=89b57f04-8b90-42f1-bd47-11fdd947af41 | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Options: {
"url": "http://orion-ld:1026/ngsi-ld/v1/entityOperations/upsert/?options=update",
"method": "POST",
"headers": {
"fiware-service": "opcua_pcs",
"fiware-servicepath": "/pcs",
"Content-Type": "application/ld+json",
"NGSILD-Tenant": "opcua_pcs",
"NGSILD-Path": "/pcs"
},
"json": [
{
"@context": "http://ld-context/ld-context/datamodels.context-ngsild.jsonld",
"id": "urn:ngsi-ld:PCS-STJ:DuctSystemHotAir",
"type": "DuctSystemHotAir",
"0HNB97CF901_LuMe_WL_TRFUnten_U": {
"type": "Property",
"value": {
"@type": "https://schema.org/Number",
"@value": 0.2824963629245758
},
"observedAt": "2024-09-26T15:45:59.444Z"
}
}
]
} | comp=IoTAgent
...
I guess the difference is then that the IoT-Agent is providing the data from the second datasource in an array with type + value for some reason. This way I should check for the difference at IoT-Agent side. Thank you very much for clarification!
Greetings Inga
Hello @kzangeli,
I have another question regarding short term history: When is an attribute saved as compound value and when as dedicated number / boolean / ... in the database?
The background is that I have two different OPC UA real-life datasources that are read via IoT-Agent OPC UA and provided to Orion-LD. Orion-LD persists the data from the two sources in different ways:
When I have a look at the data models I don't understand why data from the first source is persisted in a different way compared to data from the second source. Here is a direct example for two different attributes that are persisted as a number in case of the WeatherObserved entity and as a compound value in the case of the process control system:
Both data models use a property name, description, type and x-ngsi-model and x-ngsi-type - the first is using a minimum additionally, but this is not true for alle WeatherObserved attributes.
Here is a full example of both entity models for further reference: