httpCall failing.... Updating Personal Weather Station with Temperature

25 views
Skip to first unread message

gor...@gmail.com

unread,
Nov 6, 2018, 3:49:29 PM11/6/18
to Wireless Sensor Tags
I get an syntax error when I attempt to execute the following KumoApp call... Would appreciate additional eyes on this simple call to see what I might be doing wrong here... Is there anything wrong with the syntax or way the html is constructed???  


KumoApp.httpCall("www.pwsweather.com/pwsupdate/pwsupdate.php?ID=LKAPPALACHIALOWRY&PASSWORD=GwbUXXX&dateutc="+KumoApp.FormatDateTime(KumoApp.Tick,"s")+"&tempf=34.88&softwaretype=Examplever1.1&action=updateraw", "GET");

Thanks in advance to any who can assist.

john simano

unread,
Nov 7, 2018, 8:16:53 AM11/7/18
to Wireless Sensor Tags
I notice you are using kumoapp.tick. I have another thread where i have problems with this. but i have no reply in that thread


maybe your issue is unrelated to mine. I just figured i would point it out.

Zhiheng Cao

unread,
Nov 7, 2018, 7:59:31 PM11/7/18
to john simano, Wireless Sensor Tags
Do you get the syntax error as soon as you start the app or when the url call happens (or supposed to happen). If former, I suggest you simplify your code to the point you no longer get any compile time error, the gradually add in more elements so you know what causes the syntax compile error.

--
You received this message because you are subscribed to the Google Groups "Wireless Sensor Tags" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wireless-sensor-...@googlegroups.com.
To post to this group, send email to wireless-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/wireless-sensor-tags.
For more options, visit https://groups.google.com/d/optout.

T Jakab

unread,
Nov 8, 2018, 10:40:29 AM11/8/18
to Wireless Sensor Tags
Build the URL as a string, output it to console and verify is correct, i.e. works in a browser or with curl or similar.

See my app below for WUnderground.


var tag = <#Temperature sensor_[12|13|21|26|32|52|62|72]_1#>;

tag.updated = function () {
    function pad(number) {
        if (number < 10) {
            return "0" + number;
        }
        return number;
    }

    var now = new Date();
    var wuDateString = now.getUTCFullYear() + "-" + pad(now.getUTCMonth() + 1) + "-" + pad(now.getUTCDate()) + "+" + pad(now.getUTCHours()) + "%3A" + pad(now.getUTCMinutes()) + "%3A" + pad(now.getUTCSeconds());

    var humidity = Number(tag.moisture);
    var sensorName = tag.name;
    var temperatureC = Number(tag.temperature);

    var temperatureF = Number(temperatureC) * 1.8 + 32;

    var dewPointF = 243.04 * (Math.log(humidity / 100) + (Number(17.625 * temperatureF) / Number(243.04 + temperatureF))) / Number(17.625 - Math.log(humidity / 100) - (Number(17.625 * temperatureF) / Number(243.04 + temperatureF)));

    var solarradiation = Number(tag.lux) * 0.0079;

    var url = "http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?action=updateraw&ID=" + <%The ID of your weather station on wunderground.com%> + "&PASSWORD=" + <%The password you use to log in to wunderground.com%> + "&dateutc=" + wuDateString + "&tempf=" + temperatureF.toFixed(2) + "&dewptf=" + dewPointF.toFixed(2) + "&humidity=" + humidity.toFixed(2)+ "&solarradiation=" + solarradiation.toFixed(0) + "&softwaretype=jbtkumoapp14_" + sensorName;

    KumoApp.Log(url, 0);

    KumoApp.httpCallExternal(url, "GET");
};
Reply all
Reply to author
Forward
0 new messages