telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
60 stars 85 forks source link

typeInformation should contain global config values, not just device + group #1515

Closed AlvaroVega closed 5 months ago

AlvaroVega commented 9 months ago

Component

Other

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

The systemd version you checked that didn't have the feature you are asking for

No response

KeshavSoni2511 commented 6 months ago

Hi @AlvaroVega, I would like to contribute on this issue. Please confirm the below understanding :

Is the issue related to

https://github.com/telefonicaid/iotagent-node-lib/blob/4b4fe6130fa2bccc3494a455050e3c80e5c1e972/lib/services/northBound/restUtils.js#L201

Please provide the detail that should be included in global config values.

Please provide API so the I can debug it. Thanks.

AlvaroVega commented 6 months ago

Currently TypeInformation is a combination of Device + Group We want that TypeInformation will be a combination of Device + Group + config.getConfig() in ofrder to simplify these tipically checks that se done: i.e: https://github.com/telefonicaid/iotagent-node-lib/blob/d1586fb65a4848ba615ad0cf0da7e39afb2fa350/lib/services/devices/deviceService.js#L267-L273

other: https://github.com/telefonicaid/iotagent-node-lib/blob/d1586fb65a4848ba615ad0cf0da7e39afb2fa350/lib/services/ngsi/entities-NGSI-v2.js#L304-L309

KeshavSoni2511 commented 6 months ago

Hi @mapedraza , I proposed the below code modifications and understanding for https://github.com/telefonicaid/iotagent-node-lib/blob/301280a4644a93a68a836ec4a9ee2278f88f515a/lib/services/ngsi/ngsiService.js#L149 to

typeInformation = { ...config.getConfig(), ...deviceInformation };

and I have confirmed that typeInformation.timestamp is true not undefined at https://github.com/telefonicaid/iotagent-node-lib/blob/d1586fb65a4848ba615ad0cf0da7e39afb2fa350/lib/services/ngsi/entities-NGSI-v2.js#L305

Please confirm, if I can proceed further and raise PR after doing changes in entities-NGSI-v2.js or any other change is required.

fgalan commented 5 months ago

Fixed by PR #1580