Open DiEVeXx opened 5 years ago
It seems some kind of casting problem in the received (i.e. QuatumLeap). From the point of view of Orion, behaviour seems to be ok. I mean, attribute value is a float 0.1972656 and Orion is notifying it.
Or maybe I don't understandint the case correctly...
If at the end is a problems with QuatumLeap I'd suggest to create a new issue in that repository with a reference (link to this one), then close this issue, pls. Thanks!
It seems some kind of casting problem in the received (i.e. QuatumLeap). From the point of view of Orion, behaviour seems to be ok. I mean, attribute value is a float 0.1972656 and Orion is notifying it.
Or maybe I don't understandint the case correctly...
If you look at the output of the echo server you can see that all attributes except the one that fails are numbers
, the one that fails is being sent as a string
.
I will short the entity and paste only the important things: "accelerometerX":{"value": -0.0488281} "accelerometerY":{"value": 0.2324218} "accelerometerZ":{"value": "6.7265625"}
As you can see, Orion is sending a notification with some values as Strings when the entity attribute is storing it as Number.
I think this is Orion's problem, not QuantumLeap's.
Thanks for the reply :)
Could you provide the update request (verb + URL + payload) that has set these attribute values at Orion, please?
Could you provide the update request (verb + URL + payload) that has set these attribute values at Orion, please?
Here the logger output of the javascript code that I use to upload values to O.C.B.
I'm using the javascript request
library
Creating updateContext request
Request url: http://192.168.1.48:1026/v1/updateContext
Request headers: { 'fiware-service': 'smartspot',
'fiware-servicepath': '/smartspot',
'Content-Type': 'application/json' }
Request body: {"contextElements":[{"id":"HOP840d8e003c76:smartspot","type":"smartspot","isPattern":false,"attributes":[{"name":"accelerometerX","type":"Number","value":"0.2050781"}]}],"updateAction":"APPEND"}
TCP Stream captured using Wireshark:
POST /v1/updateContext HTTP/1.1
fiware-service: smartspot
fiware-servicepath: /smartspot
Content-Type: application/json
host: 192.168.1.48:1026
accept: application/json
content-length: 194
Connection: close
{"contextElements":[{"id":"HOP840d8e003c76:smartspot","type":"smartspot","isPattern":false,"attributes":[{"name":"accelerometerY","type":"Number","value":"0.2832031"}]}],"updateAction":"APPEND"}HTTP/1.1 200 OK
Connection: close
Content-Length: 231
Content-Type: application/json
Fiware-Correlator: a911e75a-719c-11e9-bff4-0242ac140003
Date: Wed, 08 May 2019 14:22:07 GMT
{"contextResponses":[{"contextElement":{"type":"smartspot","isPattern":"false","id":"HOP840d8e003c76:smartspot","attributes":[{"name":"accelerometerY","type":"Number","value":""}]},"statusCode":{"code":"200","reasonPhrase":"OK"}}]}
I really don't know why GitHub is putting this answer up...
There are two relevant things in the update request you are using:
"value":"0.2832031"
A possible solution for this is:
0.2832031
instead of "0.2832031"
(In seems my comment is also being put up. Funny :)
I'm having some troubles with Subscription notification in Orion Context Broker.
When a notification is returned to QuantumLeap (i want to show values in Grafana), most of the time the values of the attributes arrive as strings (but sometimes not.. it's weird). So QuantumLeap gives me an exception (
crate.client.exceptions.ProgrammingError: SQLActionException[ColumnValidationException: Validation failed for accelerometery: Cannot cast '0.2109375' to type long]
). but all values are properly stored in Orion asNumber
Here the configuration. Docker-compose files:
Orion context Broker stored entity:
Subscription creation (I want to be notified when any attribute changes):
Full error log:
Using an
echo server docker image
subscribed to the same entity I can see that some attributes of the notifications are returned asstrings
(accelerometerZ this time) but other times asfloat
.echo server notification body: