cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Service did not execute complitely

aalbot
1-Newbie

Service did not execute complitely

Hi,

     I want to send a json data from Node MCU, and decode the data by thingworx service. Unfortunately, the service did not execute complitely.

Here are my service and the test data:

Service:

     No input and output.

var obj = me.data;

var temperatureString = obj.T;

if(temperatureString != null){

    me.Temperature = Number(temperatureString);

}

var humidityString = obj.H;

if(humidityString != null){

   me.Humidity = Number(humidityString);

}

var airString = obj.A;

if(airString != null){

    me.Air = Number(airString);

}

var pressureString = obj.P;

if(pressureString != null){

    me.Pressure = Number(pressureString);

}

var windDirectionString = obj.D;

if(windDirectionString != null){

    me.WindDirection = Number(windDirectionString);

}

var windSpeedString = obj.S;

if(windSpeedString != null){

    me.WindSpeed = Number(windSpeedString);

}

var rainFallString = obj.R;

if(rainFallString != null){

    me.RainFall = Number(rainFallString);

}

Test data:

{"T":"233","H":"233","P":"233","A":"233","S":"233","D":"233","R":"233"}

I save the json data in "data" propertity and I wrote a subscription to listen the "DataChange" event ------ execute the service.

Unfortunately, only temperature change to "233", others still looked like zero.


Here are the propertities and the permissions.


J97M)~D]}{{PS%]9R10}]`4.png

R`03H5]6CBVM]GTA{]TQU}N.png

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:aalbot)

I would start by logging out each of the items you are assigning just to make sure they have a value.

It may be that the JSON is not being read the way you think it is.

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:aalbot)

I would start by logging out each of the items you are assigning just to make sure they have a value.

It may be that the JSON is not being read the way you think it is.

Hi Pai,

     In fact, when I tested the service by clicked the button, all data changed to "233", but when I executed the service by listen the "DataChange" event, it did not execute complitely. Why?

Top Tags