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
59 stars 84 forks source link

Timeinstant as attribute case (not measure) #1557

Closed AlvaroVega closed 2 months ago

AlvaroVega commented 5 months ago

Component

No response

Is your feature request related to a problem? Please describe

When timestamp conf if false but:

attribute map is: Param | Att Entity | type Datetime | Timestamp | DateTime TimeInstant | DateObserved | Datetime

measure contains: DateTIme: TimeInstant:

metadatas are lose

Full case is described at https://github.com/telefonicasc/jcyl-project/issues/153

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

AlvaroVega commented 4 months ago

Testing with device with timestamp true and the following mapping

Screenshot from 2024-02-23 11-15-02

and with the follow measure:

curl -i -X POST 'http://localhost:7897/iot/json?i=disp1&k=zrvj173zhvzb12t233z48vg96' -d '{ "TimeInstant": "2024-02-22T08:02:23.000Z", "datetime": "2024-02-22T08:02:23.000Z", "color": "blue"}' -H 'content-type: application/json'

entity has provided TimeInstant in metadata attributes (as expected IMHO):

Screenshot from 2024-02-23 11-16-19

AlvaroVega commented 4 months ago

Testing with device with timestamp false and the following mapping

Screenshot from 2024-02-23 11-15-02

and with the follow measure:

curl -i -X POST 'http://localhost:7897/iot/json?i=disp1&k=zrvj173zhvzb12t233z48vg96' -d '{ "TimeInstant": "2024-02-22T08:02:23.000Z", "datetime": "2024-02-22T08:02:23.000Z", "color": "blue"}' -H 'content-type: application/json'

entity has no metadata (as expected IMHO):

Screenshot from 2024-02-23 11-18-10

AlvaroVega commented 3 months ago

Testing with a group with timeinstant=true and the following measures:

curl -i -X POST --location 'http://localhost:7897/iot/json?i=disp1&k=APIKEY1' --header 'Content-Type: application/json' --data '{"hola":"adios", "TimeInstant": "2022-02-02T22:22:22.222Z"}'

curl -i -X POST --location 'http://localhost:7897/iot/json?i=disp2&k=APIKEY1&t=2022-02-02T22:22:22.222Z' --header 'Content-Type: application/json' --data '{"hola":"adios"}'

both cases entity TimeInstant has provided value (2022-02-02T22:22:22.222Z) and metadata Timeinstant is also filled with that value (2022-02-02T22:22:22.222Z)

AlvaroVega commented 3 months ago

When a mapping is defined like attribute map is: Param | Att Entity | type mydatetime | Timestamp | DateTime

and a measure arrives like:

curl -i -X POST --location 'http://localhost:7897/iot/json?i=SENSOR&k=APIKEY1' --header 'Content-Type: application/json' --data '{"hola":"adios", "mydatetime": "2022-02-02T02:22:22.222Z"}'

then entity TimeInstant and metadata Timeinstant has system timeinstnat, not provided in mydatetime ("2022-02-02T02:22:22.222Z")

fgalan commented 2 months ago

Fixed by PR https://github.com/telefonicaid/iotagent-node-lib/pull/1593