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

thingworx composer weather error using wunderground

Visitor

thingworx composer weather error using wunderground

I am a beginner developer who is learning through video lectures provided by tingworx.

I have problem....ㅠㅠ

In video lecture, we use yahoo to show the weather according to the location through gauage

It was a video lecture using yahoo api but it did not work well and I used wunderground

make thing, thing template, mash up..

The cause is that the services of thing template seems to be a problem

thing template - services - script

var apiKey = "c877000237f6f6a6";


var temperature;

var humidity;

var LocationIn; 

//Inputted location needs to be valid lat, long: 40.7127, 74.0059
if(LocationIn != null){
    var test = LocationIn + "40.7127, 74.0059 ";
    var arrayLocations = test.split(",");
    var lat = arrayLocations[0];
    var long = arrayLocations[1];

    var prm = {
        url: "http://api.wunderground.com/api/"+apiKey+"/conditions/q/"+lat+","+long+".json",
        timeout: 60
    };

    var json = Resources["ContentLoaderFunctions"].PostJSON(prm);
             
    try {
        temperature = parseInt(json.current_observation.temp_f);
        humidity = parseInt(json.current_observation.relative_humidity);
   
        me.Temperature = temperature;
        me.Humidity = humidity;
        result = "Success. Properties are updated.";
    } catch(err) {
        logger.error("Could not parse temperature and humidity for location: " + LocationIn
           + ". All valid Longitudes and Latitudes values must have decimal points"                      + " and be located where weather measurements are commonly taken (near cities).");
        result = "Failed. Check Script Logs";
    }
}

and base type : infotable

error message is "Unable To Convert From org.mozilla.javascript.UniqueTag to INFOTABLE"

what problem? Temperature and humidity of the gauge do not react

help me please

2 REPLIES 2

Re: thingworx composer weather error using wunderground

Hi Jeong, can you share the service definition for this script? What are you attempting to return as result from that service? How is it bound to those widgets? Additionally, would it be possible to share which video link you are following?

Re: thingworx composer weather error using wunderground

My intention is to set the position on the left tab, temperature and humidity will be displayed on the gauge depending on the position...

and video url : PTC Learning Connector

'Creating a Mashup'

in this video use yahoo weather informaion, but yahoo not working

so i used wounderground intead of yahoo