leoherzog / WundergroundStationForwarder

🌦️ Google Apps Script code to send your weather station data to Wunderground, Windy, PWSWeather, Weathercloud, OpenWeatherMap, WindGuru, and/or CWOP
42 stars 6 forks source link

no precipitation/UV export to PWS weather #6

Closed Dainiux closed 2 years ago

Dainiux commented 2 years ago

Solar radiation data export to PWS Weather does not work correctly No precipitation data export to PWS Weather

leoherzog commented 2 years ago

Thanks for the heads up! I don't have a weather station with a UV sensor so I can't test, but can you try changing if (station.uv != null) request += '&uv=' + station.uv; to if (station.uv != null) request += '&UV=' + station.uv; on Line 101 and see if that fixes it?

Dainiux commented 2 years ago

Hello problem was with Solar Radiation, not UV. But I have checked a code, it is missing precipitation and solar radiation export to PWS at all. I wrote it, you can change pws export code into this one:

function updatePWSWeather_() {

let station = JSON.parse(CacheService.getScriptCache().get( 'weatherstation'));

let request = 'https://pwsupdate.pwsweather.com/api/v1/submitwx'; request += '?ID=' + pwsWeatherStationID; request += '&PASSWORD=' + pwsWeatherPassword; request += '&dateutc=' + Utilities.formatDate(new Date(station.obsTimeUtc ), 'UTC', 'yyyy-MM-dd HH:mm:ss'); request += '&tempf=' + station.imperial.temp; if (station.imperial.windSpeed != null) request += '&windspeedmph=' + station.imperial.windSpeed; if (station.imperial.windGust != null) request += '&windgustmph=' + station.imperial.windGust; if (station.winddir != null) request += '&winddir=' + station.winddir; if (station.imperial.pressure != null) request += '&baromin=' + station. imperial.pressure; if (station.imperial.dewpt != null) request += '&dewptf=' + station. imperial.dewpt; if (station.humidity != null) request += '&humidity=' + station.humidity; if (station.solarRadiation != null) request += '&solarradiation=' + station.solarRadiation; if (station.uv != null) request += '&uv=' + station.uv; if (station.imperial.precipRate != null) request += '&rainin=' + station. imperial.precipRate; if (station.imperial.precipTotal != null) request += '&dailyrainin=' + station.imperial.precipTotal; request += '&softwaretype=appsscriptwundergroundforwarder&action=updateraw';

let response = UrlFetchApp.fetch(request).getContentText();

console.log(response);

return response;

}

On Thu, Nov 11, 2021 at 9:35 PM Leo @.***> wrote:

Thanks for the heads up! I don't have a weather station with a UV sensor so I can't test, but can you try changing if (station.uv != null) request += '&uv=' + station.uv; to if (station.uv != null) request += '&UV=' + station.uv; on Line 101 https://github.com/leoherzog/WundergroundStationForwarder/blob/master/code.gs#L101 and see if that fixes it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leoherzog/WundergroundStationForwarder/issues/6#issuecomment-966570743, or unsubscribe https://github.com/notifications/unsubscribe-auth/APBYCNPWG546FYXPR4QJFB3ULQLHNANCNFSM5H3E76LQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

leoherzog commented 2 years ago

Helpful! Thank you!