Giter Site home page Giter Site logo

leoherzog / wundergroundstationforwarder Goto Github PK

View Code? Open in Web Editor NEW
35.0 11.0 6.0 169 KB

๐ŸŒฆ๏ธ Google Apps Script code to send Wunderground/MyAcurite/Weatherlink/Tempest/Ambient Weather PWS data to Wunderground, Windy, PWSWeather, Weathercloud, OpenWeatherMap, WindGuru, and/or CWOP

JavaScript 100.00%
wunderground wunderground-pws windy pws pws-weather pws-weather-data weathercloud weather google-apps-script apps-script

wundergroundstationforwarder's Introduction

Station Forwarder

This code is built to be hosted on the free Google Apps Script platform. It takes in weather station data from:

and periodically sends it on to

Setup

  1. Create a new Google Apps Script project and give it a name
  2. Overwrite the default Code.gs file with code.gs from the latest release in this repository
  3. Configure the script for you:
  • Choose your datasource:

    IBM Wunderground

    Uses the IBM Wunderground API.

    Note: Unfortunately, it looks like the new Wunderground API keys have started expiring 6 months after being generated, so you may need to replace the key if that happens.

    • Set the datasource to ibm on line 10
    • Set your ibmAPIKey on line 12
    • Set your ibmStationId on line 13
    MyAcurite

    Experimental. Uses the undocumented MyAcurite private API.

    • Set the datasource to acurite on Line 10
    • Set your acuriteUsername on Line 15
    • Set your acuritePassword on line 16
    • Set your acuriteHubName (the user-set name on the internet-connected receiver) on line 17
    • Set your acuriteStationName (the user-set name of the outdoor sensor/station) on line 18
    Davis Weatherlink

    Uses the Davis Weatherlink API v2.

    • Set the datasource to davis on line 10
    • Set your davisApiKey on line 20
    • Set your davisApiSecret on line 21
    • Set your davisStationName on line 22
    Weatherflow Tempest

    Uses a Weatherflow Tempest Personal Use Token.

    • Set the datasource to weatherflow on Line 10
    • Set your weatherflowPUT on line 24
    • Set your weatherflowSationId on Line 25
    Ambient Weather

    Uses the Ambient Weather API.

    • Set the datasource to ambient on Line 10
    • Set your ambientWeatherStationName on line 27
    • Set your ambientWeatherApiKey on Line 28
  • and choose one or more forwarding destinations:

    IBM Wunderground

    To send to Wunderground:

    • Set updateWunderground to true on Line 32
    • Set your wundergroundAPIKey on Line 33
    • Set your wundergroundStationId on line 34
    Windy.com

    To send to Windy.com:

    • Set updateWindy to true on Line 36
    • Set your windyAPIKey on Line 37
    • Set your windyStationId on line 38. It's likely 0, 1, 2, etc.
    Aeris PWSWeather

    To send to PWSWeather:

    • Set updatePWSWeather to true on Line 40
    • Set your pwsWeatherAPIKey from your station's admin page on line 41
    • Set your pwsWeatherStationID on Line 42
    WeatherCloud

    To send to WeatherCloud:

    Retrieve your station's ID and API Key by going to your Devices, then clicking Settings โ†’ ๐Ÿ”Œ Link on your station.

    • Set updateWeatherCloud to true on Line 44
    • Set your weathercloudStationId on line 45
    • Set your weathercloudAPIKey on Line 46
    • Set whether or not you have a WeatherCloud Pro or Premium account with hasWeatherCloudPro as true or false on line 47
    OpenWeatherMap

    Creation of a new OpenWeatherMap station must be done by API, not on the OpenWeatherMap website. More information is available in the OpenWeatherMap Station API documentation. The basic concept for what must be done is available in the createNewOWMStation_() function. Remove the _ character from the name of that function to make it selectable from the โ–ท Run button in the toolbar. If you do so, make sure you note your new station's ID and other details in the log (available in the Executions tab in the sidebar after running!), then:

    WindGuru

    Send to WindGuru:

    Start by registering a new "Other / Upload API" station, then:

    • Set updateWindGuru to true on Line 53
    • Set windGuruStationUID to your chosen station UID on Line 54
    • Set your windGuruStationPassword to your chosen station API password (note, not your account's password) on line 55
    NOAA Citizen Weather Observer Program (CWOP)

    Send to CWOP. Start by registering for a new station, then when you receive your email:

    • Set updateCWOP to true on Line 57
    • Set cwopStationIDOrHamCallsign to your assigned CWOP station ID that you received via email on Line 58
    • If you are using your ham radio callsign as your station ID and you have received a validation code from NOAA CWOP support, set cwopValidationCode to your validation code on Line 59
  1. Run the "Schedule" function with the โ–ท Run button in the toolbar. You're done! You can see it periodically running in the โ˜ฐโ–ถ Executions tab on the left sidebar. This code is executed on Google's servers and does not require a computer to remain on.

If you ever make changes to the API keys or enabled services, just run the Schedule function again.

How to Update

  1. Copy the code from code.gs in this release over your Code.gs file.
  2. Make sure your API Keys and settings at the top of the file are correct and ๐Ÿ’พ Save.
  3. Run the Schedule function again with the โ–ท Run button in the toolbar.

License

Feel free to take a look at the source and adapt as you please. This source is licensed as follows:

Creative Commons License

Station Forwarder is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Buy Me A Tea Found this helpful? Buy me a tea!

wundergroundstationforwarder's People

Contributors

leoherzog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wundergroundstationforwarder's Issues

Failed Execution

Hello,

First of all great project been looking for something like this for quite some time.

I can't seem to get the forwarding to work

for Weathercloud I get

TypeError: (intermediate value).inTomm is not a function
at updateWeathercloud
(forwarder_pws_kattau2:119:111)_

for PWSWeather I get

Exception: Invalid Argument: http://www.pwsweather.com/pwsupdate/pwsupdate.php?ID=PWSKATTAU&PASSWORD=xxxxxxxxxxxx&dateutc=2020-12-11%2019:57:18&tempf=35.7&windspeedmph=0&winddir=179&baromin=29.44&dewptf=34.7&humidity=96&uv=0
at updatePWSWeather
(forwarder_pws_kattau2:97:30)_

Note: Password is correct, just changed it for the copy and paste!

Thanks!

WindGust is missing for PWSWeather

Hello,

in the function updatePWSWeather_() the following line is missing:
if (station.imperial.windGust != null) request += '&windgustmph=' + station.imperial.windGust;

By adding this line the windGust will also be provided.

Best regards, and thanks for the script,
judgetom

Date format in pwsweather.com

Hello @leoherzog!

Thanks for sharing this script, it is really useful!

I started uploading to pwsweather.com, but it just worked for 12 hours of the day... The problem is that the station wasn't sending time in a 24-hour format. And, occasionally, sent an old date stamp. From the server logs, the timestamp goes from 12 back to 01.

Solution: in code.gs, line 88

request += '&dateutc=' + Utilities.formatDate(new Date(station.obsTimeUtc), 'UTC', 'yyyy-MM-dd hh:mm:ss');

change the time format, replacing "hh" (lowercase) by "HH" (uppercase).

It worked for me.

Cheers.

Issues while forwardig WeatherFlow Tempest data to WU

Hi,
I have been trying your AppScript code from version 2.3.0 to the current 2.5.0, to upload my Tempest Weather Station data to Weather Underground, unfortunately the WU upload doesn't seem to work properly. I see discrepancies in the pressure data, wind speed, wind gust data, rain rate and also rainfall.
The pressure data fluctuates between two values, wind speed and wind gust are reported in steps, for example wind speed is reported in steps of 1.6, and so is the wind gust. Similarly, I think the cumulative rainfall data is also reported in incremental values of 0.25/0.26 mm. When it comes to rain rate, it is not able to capture this information.
The rest of the data like, temperature, dew point, wind direction, radiation and UV seem to be okay.
In order to have a comparison of the data forwarded by your appsscript to WU and also the data forwarded by Weatherflow to WU, I setup two stations in Weather Underground, but both receiving weather data from the same Tempest Station, while one receives the data from WeatherFlow in 5 minutes interval and the other through your appsscript code in 1 minute interval. I have attached a comparison of the two sets of data in the form of a screenshot attachment, to the left is the data forwarded by Weatherflow and to the right is the data forwarded by AppsScript. The compared data is from an identical time frame.
Hope this information helps you to refine your future versions of Wunderground Station Forwarder.
Thanks

WeatherFlow vs AppScript

WU to PWSWeather.com not updating PWSWeather.com

Trying to link WU to PWSWeather.

Weather station uploads to WU with no issues, but is not compatible with PWSWeather.

No error messages have been found/seen and script says it ran just fine... when run manually. Automatic scheduling is not working, see other issue report.

I've checked and verified all the IDs and keys and followed directions in the readme.

Wrong unit for weathercloud barometric pressure

Barometric pressure is not logged for weathercloud.net because the unit is wrong.
if (station.imperial.pressure != null) request += '&**baromin**=' + (new Number(station.imperial.pressure).**inhgTohPa**() * 10).toFixedNumber(0);
The argument in line 125 should be "bar" instead of "baromin".

Script error with Weathercloud

1st up this is brilliant, I have this working to upload my Tempest data to PWSWeather. When I was configuring the script I was receiving a code error with Line 85 which I resolved by commenting out the code, as of now working perfectly but then again I don't use Weathercloud.

As FYI below my config with line 85 commented out in the script code.

image

Google Advanced Protection ??

All, anyone managed to have this script run on an account using Google Advanced Protection?

I worked around it by using another Google account I have but I prefer not to do that :-)

Thanks any help appreciated.

Additional Parameters for WeatherCloud

Found a few additional parameters you can pass to WeatherCloud if you wanted to add them:

Current Day Precipitation Total -> &rain
Solar Radiation -> &solarrad
Dewpoint -> &dew
Heat Index -> &heat
Wind Chill -> &chill
Wind Gust -> &wspdhi

Scheduling Script

The code does not seem to be setting up automatic scheduling. Trying to link WU to PWSWeather.com.

Execution status only shows when I run it manual.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.