2 Replies Latest reply on Nov 29, 2017 12:56 AM by jpak RSS
    jpak Newbie

    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