Open GuillaumeOd opened 1 month ago
@fgalan I ask you if @GuillaumeOd can provide the PR that fixes this issue. We need it to fix our use case.
Could you please provide equivalent json sent to Orion in 4.6.0 for the same example? And maybe provide device/group provisioned and measure received?
A test case about his POC could added to functional tests: https://github.com/telefonicaid/iotagent-node-lib/blob/master/test/functional/testCases.js
@fgalan I ask you if @GuillaumeOd can provide the PR that fixes this issue. We need it to fix our use case.
PRs with fixes are always welcome! :)
Anyway, take into account the feedback provided by @AlvaroVega in previous comment.
The primary difference between the two payloads is the absence of the "value" attribute in version 4.6.0.
Device Update Logs
The following logs detail the data structure when updating the device, captured via function sendUpdateValue(entityName, attributes, typeInformation, token, callback).
Then this happens when an attribute has name 'value' like: ?
{ name: 'value', type: 'number', object_id: 't' }
Maybe type, value are reserved words...
This is the requested test case https://github.com/telefonicaid/iotagent-node-lib/pull/1668 which demostrate this case and which make not neccesarry this PR https://github.com/telefonicaid/iotagent-node-lib/pull/1667
I got the problem with object_id
that I encountered #1621
I got the problem with
object_id
that I encountered #1621 https://github.com/telefonicaid/iotagent-node-lib/issues/1621#issuecomment-2182191845
IoT Agent Node Lib version the issue has been seen with
4.6.0
Bound or port used (API interaction)
Southbound (Devices data API)
NGSI version
NGSIv2
Are you running a container?
Yes, I am using a contaner (Docker, Kubernetes...)
Image type
normal
Expected behaviour you didn't see
When upgrading iot-agent-node-lib from 3.3.4 to 4.6.0
It should correctly updating a device attribute when using
iotAgentLib.update(device.name, device.type, "", [ { name: 'value', type: 'number', value: '10' }], device)
iot-agent-node-lib 3.3.4 is still working perfectly
Unexpected behaviour you saw
The payload request made to Orion is perfectly sent but does not contain de requested change on the device attribute
Here's what is sent to Orion in 3.3.4 :
In 4.6.0 the payload is exactly the same but the "value" attribute in the request has disappeared, so the request is sent to Orion but without the updated value on the device. End to end, this leads to having the exact same device in orion as the upsert request did not sent the attribute to update.
I believe this comes from
sendUpdateValueNgsi2()
inentities-NGSI-v2.js
as this function changed a lot between 3.3.4 and 4.6.0.After some debugging and analysis, it's coming from the line
measures = measures.filter((item) => item.name !== currentAttr.object_id && item.name !== currentAttr.name);
that removes the measuresvalue
. The second part of the filteritem.name !== currentAttr.name
is going to filter all attributes names that are present inpreprocessedAttr
but it containstypeInformation.active
fromoriginTypeInformation
which contains thevalue
attribute...Steps to reproduce the problem
No response
Configs
iot-agent-node-lib config
Log output
No response