iotagent-node-lib icon indicating copy to clipboard operation
iotagent-node-lib copied to clipboard

IOTA updating metadata but not the value

Open fgalan opened this issue 5 years ago • 2 comments

It seems that under some circumstances (we have asked for more information) upon receiving a measure the IOTA is updating attribute metadata of entities not belonging to that measure, but without updating the attribute itself.

For instance: we have and entity with attributes A, B, C, D in CB this way:

  • A=1, TimeInstant = 10:10
  • B=2, TimeInstant = 10:10
  • C=3, TimeInstant = 10:10
  • D=4, TimeInstant = 10:10

IOTA receives the following (UL) at 10:30 in the device associated to that entity:

C|30|D|4

The entity now is:

  • A=1, TimeInstant = 10:30
  • B=2, TimeInstant = 10:30
  • C=30, TimeInstant = 10:30
  • D=40, TimeInstant = 10:30

The weird thing is that IOTA doesn't know the values or A and B (the didn't come in the measure) and, as far as I remember, there is no operation in CB that allows updating metadata without specifying also the attribute value in the same request.

To be analyzed.

fgalan avatar Nov 18 '20 11:11 fgalan

We should remark that the current use case involve the multientity plugin so:

Measures A, B -> Entity1 AttrA, AttrB Measures C, D -> Entity2 AttrC, AttrD

Measures varies, some: A|30|B|4

and some

A|30|B|4|C|33|D|45

mrutid avatar Nov 18 '20 11:11 mrutid

I've been testing with a device provisioned:

{"device_id":"dispAVG","service":"smartcity","service_path":"/","entity_name":"thing:dispAVG","entity_type":"thing","timestamp":true,"transport":"HTTP","attributes":[{"object_id":"a","name":"a","type":"string","entity_name":"entity1"},{"object_id":"b","name":"b","type":"string","entity_name":"entity1"},{"object_id":"c","name":"c","type":"string","entity_name":"entity2"},{"object_id":"d","name":"d","type":"string","entity_name":"entity2"}],"lazy":[],"commands":[],"static_attributes":[],"protocol":"IoTA-JSON","explicitAttrs":false}

and sending measures:

mosquitto_pub -h localhost -t /json/rabp0c3vzt6jydn5wer9q7txw/dispAVG/attrs -m '{"a": 1, "b": 2, "c": 3, "d": 4}' mosquitto_pub -h localhost -t /json/rabp0c3vzt6jydn5wer9q7txw/dispAVG/attrs -m '{"c": 4, "d": 5}'

and the entity values keeps like expected:

{"id":"entity1","type":"thing","TimeInstant":{"type":"DateTime","value":"2020-11-24T14:34:18.128Z","metadata":{}},"a":{"type":"string","value":1,"metadata":{"TimeInstant":{"type":"DateTime","value":"2020-11-24T14:34:18.128Z"}}},"b":{"type":"string","value":2,"metadata":{"TimeInstant":{"type":"DateTime","value":"2020-11-24T14:34:18.128Z"}}}}
{"id":"entity2","type":"thing","TimeInstant":{"type":"DateTime","value":"2020-11-24T14:34:41.421Z","metadata":{}},"c":{"type":"string","value":4,"metadata":{"TimeInstant":{"type":"DateTime","value":"2020-11-24T14:34:41.421Z"}}},"d":{"type":"string","value":5,"metadata":{"TimeInstant":{"type":"DateTime","value":"2020-11-24T14:34:41.421Z"}}}}

AlvaroVega avatar Nov 24 '20 14:11 AlvaroVega