Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
hello
I followed the document associated with the Sigfox extension and I managed to connect my device to a thingworx thing.
I receive well the messages but unfortunately I am not able to process with the data (a simple ASCII message for tests : "39314350553a3336") and so Thingworx return an internal error 500 to Sigfox.
I did not find where and how to add rows into the infotable provided to decode sigfox messages , perhaps this is the root cause ?
I just need to translate the message from hexa to Ascii for the moment.
here are the log :
ERROR | Execution error in service script [Sigfox.CallbackInterface CallbackDataBatch] : Wrapped com.thingworx.common.exceptions.InvalidRequestException: Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. Cause: Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. | Administrator | S.c.t.d.e.DSLProcessor | http-bio-8080-exec-45 | |||
2016-07-18 11:14:17.823 | WARN | Sigfox.CallbackInterface::CallbackDataBatch: received 1 lines | Administrator | S.c.t.d.e.DSLScript | http-bio-8080-exec-45 | ||
2016-07-18 11:14:17.823 | WARN | Sigfox.CallbackInterface::CallbackDataBatch: line 0: 1468833195;F0A62;18.34;-128.00;35.34;0DBE;39314350553a3336;43;3;2341; | Administrator | S.c.t.d.e.DSLScript | http-bio-8080-exec-45 | ||
2016-07-18 11:14:17.823 | ERROR | Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. | Administrator | S.c.t.d.e.DSLProcessor | http-bio-8080-exec-45 | ||
2016-07-18 11:13:17.660 | ERROR | Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. | Administrator | S.c.t.d.e.DSLProcessor | http-bio-8080-exec-47 | ||
2016-07-18 11:13:17.660 | ERROR | Execution error in service script [Sigfox.CallbackInterface CallbackDataBatch] : Wrapped com.thingworx.common.exceptions.InvalidRequestException: Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. Cause: Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. | Administrator | S.c.t.d.e.DSLProcessor | http-bio-8080-exec-47 | ||
2016-07-18 11:13:17.659 | WARN | Sigfox.CallbackInterface::CallbackDataBatch: received 1 lines | Administrator | S.c.t.d.e.DSLScript | http-bio-8080-exec-47 | ||
2016-07-18 11:13:17.659 | WARN | Sigfox.CallbackInterface::CallbackDataBatch: line 0: 1468833195;F0A62;18.34;-128.00;35.34;0DBE;39314350553a3336;43;3;2341; |
thanks
PAscal
Pascal,
An excerpt from the extension guide for SIGFOX:
"In this example, it is “21bbb93370aff337”. To decode this data on the ThingWorx side into usable text and numbers, the FrameUtilities Extension will be utilized (covered later in this guide)."
Also, did you follow step 4 on page 7 about the CallbackDataBatch service? This talks about creating a new Thing which implements the Sigfox.GenericDeviceThingShape.
Step 5 on page 9 also outlines some sample code that is needed and not included in the extension by default.
Finally, on page 13 the FrameUtilitiesThing is described, and I believe this might be what you need to look into for decoding a message.
Meghan
Hi Meghan
Yes I followed these steps and added the code for the callback "UpdateData"
What I cannot find how to do is to create the rows into the infotable as described at the top of the page 11
(fieldName,bitStart,bitEnd,isLittelEndian)
Do I have to progamm it or is it accessible using an HMI somewhere ?
Pascal
Pascal,
You will need to add an InfoTable property with DataShape to the Thing you've created that implements the Sigfox.GenericDeviceThingShape. This is what the UpdateData service is referencing in the Javascript code:
var params = {
data: data /* STRING */,
frameFormat: me.frameFormat /* INFOTABLE */
};
// because the decode frame returns a string, we must parse it as a json first.
// this is done because of issues with services returning json directly
var result =
JSON.parse(Things["FrameUtilitiesThing"].decodeFrame(params));
// we set props for our thing
me.prop1 = result.prop1;
me.prop2 = result.prop2;
Anything with "me." in front of it is accessing a property on the current Thing exercising the service. The decodeFrame function needs you to create that frameFormat InfoTable property on the Thing so it can iterate through the entries in that table.
The DataShape used for the InfoTable can also be modified to include more properties to represent each field included in a frame. If you want to use a completely different DataShape for this you will need to modify the frameFormat input parameter for the decodeFrame service on the FrameUtilitiesThing as well; encodeFrame should also be adjusted for the fields you are sending.
If there is still something missing or not working as it should let me know.
Hello
I have now a license for Thingworx and I have restarted the Sigfox implementation.
I want to decode the data into my own script (UpdateData() ) as it is more complex than the offered FrameUtilities.
I am always facing the same issue , it seems that UpdateData() is never called because there is issue before into getSigfoxDeviceFromSigfoxId() :
I dont know what "JSONObject["value"] not found" means and why it is repeated 4 times in the error log???
Execution error in service script [Sigfox.CallbackInterface CallbackDataBatch] : Wrapped com.thingworx.common.exceptions.InvalidRequestException: Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found. Cause: Execution error in service script [Sigfox.CallbackInterface getSigfoxDeviceFromSigfoxId] : Wrapped org.json.JSONException: JSONObject["value"] not found. Cause: JSONObject["value"] not found.
the Sigfox callback :
batch :
{time};{device};{snr};{rssi};{avgSnr};{station};{data};{lat};{lng};{seqNumber};
well received into Thingworx :
Sigfox.CallbackInterface::CallbackDataBatch:
line 0: 1479155012;F0A62;34.47;-117.00;55.47;0A93;31304350553a3339;49;2;2839;
Regards
I found the issue.
I was usually using ";" as separator in sigfox batch and Thingworx script is using "," as sepator to parse the datas
Thanks for help