Weather Underground Raw PWD Data Update

This his a flow to send raw data to Weather Underground using a URL/API via a Post using a URL below

https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID????&PASSWORD=????&dateutc=now&tempf=23 .....

You will need to sign up at https://www.wunderground.com/ and create a Person Weather Station ID which will get you an ID and Password/Key which you need use in the Node-RED flow.

[{"id":"5675c6cf.d139e8","type":"tab","label":"WU Flow","disabled":false,"info":""},{"id":"304fb3fd.ffb6ac","type":"http request","z":"5675c6cf.d139e8","name":"Post to WU","method":"POST","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":610,"y":400,"wires":[["86b6b307.a04d4"]]},{"id":"446ae5e6.81bc6c","type":"function","z":"5675c6cf.d139e8","name":"Craete URL","func":"pwsid= flow.get(\"pwdid\");\npwspw= flow.get(\"pwdpw\");\nif(pwsid === undefined)\n{\nnode.warn(\"Please set PWS id and Password/key 1st!\")\nreturn null\n}\nvar str = \"https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=\"+pwsid+\"&PASSWORD=\"+pwspw\nstr += \"&dateutc=now\";\nstr += \"&tempf=\";\nstr += flow.get(\"tempf\");\nstr += \"&humidity=\";\nstr += flow.get(\"humidity\");\nstr += \"&windspeedmph=\";\nstr += flow.get(\"windspeedmph\");\nstr += \"&rainin=\";\nstr += flow.get(\"rainin\");\nstr += \"&winddir=\";\nstr += flow.get(\"winddir\");\nstr += \"&uv=\";\nstr += flow.get(\"uv\");\nstr += \"&solarradiation=\";\nstr += flow.get(\"solarradiation\");\nstr += \"&action=updateraw\";\nstr += \"&realtime=1&rtfreq=30\"\nmsg.time=Date.now()\nmsg.url = str\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":400,"wires":[["304fb3fd.ffb6ac","7041683.98e9398"]]},{"id":"22126ed.0674b92","type":"inject","z":"5675c6cf.d139e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":400,"wires":[["446ae5e6.81bc6c"]]},{"id":"7041683.98e9398","type":"debug","z":"5675c6cf.d139e8","name":"RawUpdateToWU","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":440,"wires":[]},{"id":"86b6b307.a04d4","type":"debug","z":"5675c6cf.d139e8","name":"to WU","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":400,"wires":[]},{"id":"9ec5b11.b39075","type":"function","z":"5675c6cf.d139e8","name":"SetFlow Vars With Random Weather Data","func":"/*\ntime: \"2020-09-19 13:32:33\"\nmodel: \"Acurite-Atlas\"\nid: 889\nchannel: \"A\"\nsequence_num: 1\nbattery_ok: 1\nsubtype: 5\nwind_avg_mi_h: 2\ntemperature_F: 69.9\nhumidity: 46\nexception: 0\nraw_msg: \"c779c581884b2e87\"\ntemperature_C: 21.06\n*/\nmsg={}\nmsg.payload={}\nmsg.payload.temperature_F=Math.floor(Math.random() * 100);  \nmsg.payload.humidity=Math.floor(Math.random() * 100);\nmsg.payload.wind_avg_mi_h=Math.floor(Math.random() * 100);\n\nflow.set(\"tempf\",msg.payload.temperature_F)\nflow.set(\"lastmsg\",Date.now())\nflow.set(\"humidity\",msg.payload.humidity)\n//flow.set(\"windspeedmph\",msg.payload.wind_avg_mi_h)\n/*\n{\"time\":\"2020-09-19 13:55:13\",\n\"model\":\"Acurite-Atlas\",\"id\":889,\n\"channel\":\"A\",\"sequence_num\":2,\n\"battery_ok\":1,\"subtype\":6,\"\nwind_avg_mi_h\":2,\n\"wind_dir_deg\":93,\n\"rain_in\":0,\"exception\":0,\"raw_msg\":\"cb79c68182740081\"}\n\n*/\nmsg.payload.rain_in=Math.floor(Math.random() * 5)\nmsg.payload.wind_dir_deg=Math.floor(Math.random() * 360)\nmsg.payload.wind_avg_mi_h=Math.floor(Math.random() * 360)\nflow.set(\"rainin\",msg.payload.rain_in)\nflow.set(\"winddir\",msg.payload.wind_dir_deg)\nflow.set(\"windspeedmph\",msg.payload.wind_avg_mi_h)\n/*\ntime: \"2020-09-19 13:50:53\"\nmodel: \"Acurite-Atlas\"\nid: 889\nchannel: \"A\"\nsequence_num: 2\nbattery_ok: 1\nsubtype: 7\nwind_avg_mi_h: 2\nuv: 2\nlux: 71930\nexception: 0\n*/\n//https://cumulus.hosiene.co.uk/viewtopic.php?t=3979\nmsg.payload.lux=Math.floor(Math.random() * 1000)\nmsg.payload.uv==Math.floor(Math.random() * 10)\nsolarradiation=msg.payload.lux*0.0079\nflow.set(\"solarradiation\",solarradiation)\nflow.set(\"uv\",msg.payload.uv)\n//flow.set(\"windspeedmph\",msg.payload.wind_avg_mi_h)\n\n\n    return msg;","outputs":1,"noerr":0,"x":460,"y":340,"wires":[["446ae5e6.81bc6c"]]},{"id":"3f45f560.ff6fba","type":"comment","z":"5675c6cf.d139e8","name":"TWC/WU Api / URL and Parameter infos","info":"PWS Upload Protocol\nPWS Upload Protocol\nHere is how to create a Personal Weather Station update to wunderground.com:\n\nBackground\nTo upload a weather condition, you make a standard HTTP GET request with the ID, PASSWORD and weather conditions as GET parameters\nURL\nHere is the URL used in the uploading (if you browse here without parameters you will get a brief usage):\nhttps://weatherstation.wunderground.com/weatherstation/updateweatherstation.php\n \nGET parameters\nNOT all fields need to be set, the _required_ elements are:\nID\nPASSWORD \ndateutc\nIMPORTANT all fields must be url escaped\nreference http://www.w3schools.com/tags/ref_urlencode.asp\nexample\n  2001-01-01 10:32:35\n   becomes\n  2000-01-01+10%3A32%3A35\nif the weather station is not capable of producing a timestamp, our system will accept \"now\". Example:\ndateutc=now\nlist of fields:\naction [action=updateraw] -- always supply this parameter to indicate you are making a weather observation upload\nID [ID as registered by wunderground.com]\nPASSWORD [Station Key registered with this PWS ID, case sensitive]\ndateutc - [YYYY-MM-DD HH:MM:SS (mysql format)] In Universal Coordinated Time (UTC) Not local time\nwinddir - [0-360 instantaneous wind direction]\nwindspeedmph - [mph instantaneous wind speed]\nwindgustmph - [mph current wind gust, using software specific time period]\nwindgustdir - [0-360 using software specific time period]\nwindspdmph_avg2m  - [mph 2 minute average wind speed mph]\nwinddir_avg2m - [0-360 2 minute average wind direction]\nwindgustmph_10m - [mph past 10 minutes wind gust mph ]\nwindgustdir_10m - [0-360 past 10 minutes wind gust direction]\nhumidity - [% outdoor humidity 0-100%]\ndewptf- [F outdoor dewpoint F]\ntempf - [F outdoor temperature]\n* for extra outdoor sensors use temp2f, temp3f, and so on\nrainin - [rain inches over the past hour)] -- the accumulated rainfall in the past 60 min\ndailyrainin - [rain inches so far today in local time]\nbaromin - [barometric pressure inches]\nweather - [text] -- metar style (+RA)\nclouds - [text] -- SKC, FEW, SCT, BKN, OVC\nsoiltempf - [F soil temperature]\n* for sensors 2,3,4 use soiltemp2f, soiltemp3f, and soiltemp4f\nsoilmoisture - [%]\n* for sensors 2,3,4 use soilmoisture2, soilmoisture3, and soilmoisture4\nleafwetness  - [%]\n+ for sensor 2 use leafwetness2\nsolarradiation - [W/m^2]\nUV - [index]\nvisibility - [nm visibility]\nindoortempf - [F indoor temperature F]\nindoorhumidity - [% indoor humidity 0-100]\nPollution Fields:\nAqNO - [ NO (nitric oxide) ppb ]\nAqNO2T - (nitrogen dioxide), true measure ppb\nAqNO2 - NO2 computed, NOx-NO ppb\nAqNO2Y - NO2 computed, NOy-NO ppb\nAqNOX - NOx (nitrogen oxides) - ppb\nAqNOY - NOy (total reactive nitrogen) - ppb\nAqNO3 -NO3 ion (nitrate, not adjusted for ammonium ion) UG/M3\nAqSO4 -SO4 ion (sulfate, not adjusted for ammonium ion) UG/M3\nAqSO2 -(sulfur dioxide), conventional ppb\nAqSO2T -trace levels ppb\nAqCO -CO (carbon monoxide), conventional ppm\nAqCOT -CO trace levels ppb\nAqEC -EC (elemental carbon) – PM2.5 UG/M3\nAqOC -OC (organic carbon, not adjusted for oxygen and hydrogen) – PM2.5 UG/M3\nAqBC -BC (black carbon at 880 nm) UG/M3\nAqUV-AETH  -UV-AETH (second channel of Aethalometer at 370 nm) UG/M3\nAqPM2.5 - PM2.5 mass - UG/M3\nAqPM10 - PM10 mass - PM10 mass\nAqOZONE - Ozone - ppb\nsoftwaretype - [text] ie: WeatherLink, VWS, WeatherDisplay\n\nExample URL\nHere is an example of a full URL:\nhttps://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&dateutc=2000-01-01+10%3A32%3A35&winddir=230&windspeedmph=12&windgustmph=12&tempf=70&rainin=0&baromin=29.1&dewptf=68.2&humidity=90&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw\nNOTE: not all fields need to be set\nResponse Text\nThe response from an HTTP GET request contains some debugging data.\nRESPONSES and MEANINGS:\nresponse\n\"success\"\nthe observation was ingested successfully\nresponse\n\"INVALIDPASSWORDID|Password and/or id are incorrect\"\ninvalid user data entered in the ID and PASSWORD GET parameters\nresponse\n<b>RapidFire Server</b><br><br>\n<b>usage</b><br>\nthe minimum GET parameters ID, PASSWORD (Station Key registered with this PWS ID, case sensitive), action, and dateutc were not set\nRapidFire Updates\nRapidFire Updates allow you to update weather station conditions at a frequency up to once observation every 2.5 seconds. Web site visitors will see these observations change in real-time on the wunderground.com site.\nA real-time update should look almost like the standard update.\nHowever, the server to request is:\nrtupdate.wunderground.com, not weatherstation.wunderground.com\nAnd, please add to the query string:\n&realtime=1&rtfreq=2.5\nwhere rtrfreq is the frequency of updates in seconds.\nhere is an example:\nhttps://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&dateutc=2000-01-01+10%3A32%3A35&winddir=230&windspeedmph=12&windgustmph=12&tempf=70&rainin=0&baromin=29.1&dewptf=68.2&humidity=90&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw&realtime=1&rtfreq=2.5\nAlert\nCan","x":220,"y":180,"wires":[]},{"id":"dec325d0.f65ec8","type":"function","z":"5675c6cf.d139e8","name":"Create URL/Parameter","func":"var str = \"https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=IRIVER22&PASSWORD=hKiHuzsa\"\nstr += \"&dateutc=now\";\nstr += \"&tempf=\";\nstr += flow.get(\"tempf\");\nstr += \"&humidity=\";\nstr += flow.get(\"humidity\");\nstr += \"&windspeedmph=\";\nstr += flow.get(\"windspeedmph\");\nstr += \"&rainin=\";\nstr += flow.get(\"rainin\");\nstr += \"&winddir=\";\nstr += flow.get(\"winddir\");\nstr += \"&uv=\";\nstr += flow.get(\"uv\");\nstr += \"&solarradiation=\";\nstr += flow.get(\"solarradiation\");\nstr += \"&action=updateraw\";\nstr += \"&realtime=1&rtfreq=30\"\nmsg.lastmsg=flow.get(\"lastmsg\")\nmsg.url = str\nmsg.payload = str.split(\"&\");\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":500,"wires":[["a59804ea.fb14f8"]]},{"id":"e0b1fe0.0d741","type":"inject","z":"5675c6cf.d139e8","name":"Debug","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":500,"wires":[["dec325d0.f65ec8"]]},{"id":"a59804ea.fb14f8","type":"debug","z":"5675c6cf.d139e8","name":"Show WU Url and Parameter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":660,"y":500,"wires":[]},{"id":"8b2ad915.5262e8","type":"comment","z":"5675c6cf.d139e8","name":"This is a Flow to send Raw data to Weather Underground","info":"","x":270,"y":60,"wires":[]},{"id":"217db527.7e1d9a","type":"inject","z":"5675c6cf.d139e8","name":"GenerateData","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":340,"wires":[["9ec5b11.b39075"]]},{"id":"7f02aeaa.a2689","type":"comment","z":"5675c6cf.d139e8","name":"https://www.wunderground.com/member/devices","info":"","x":490,"y":120,"wires":[]},{"id":"aa3045fb.3cceb8","type":"comment","z":"5675c6cf.d139e8","name":"Create a Device/PWS here ","info":"","x":170,"y":120,"wires":[]},{"id":"e66a5f6b.536fc","type":"comment","z":"5675c6cf.d139e8","name":"Adjust the Station ID & Password >>> ","info":"https://www.wunderground.com/member/devices","x":210,"y":240,"wires":[]},{"id":"d8cdeb9c.274d28","type":"function","z":"5675c6cf.d139e8","name":"Set PWSID and Password on the flow ","func":"pwsid= flow.set(\"pwdid\",\"\");// Example ITORON113\t...\npwspw= flow.set(\"pwdpw\",\"\");\npwsid= flow.get(\"pwdid\");\npwspw= flow.get(\"pwdpw\");\nif(pwsid === undefined)\n{\nnode.warn(\"Please set PWS id and Password/key  1st!\")\nreturn null\n}\nmsg.payload=\"PWD ID set !\"\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":240,"wires":[["cc322fa5.30b1b"]]},{"id":"ce0cad74.21ca","type":"inject","z":"5675c6cf.d139e8","name":"Run 1st","topic":"Set PWDIS and Password","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":240,"wires":[["d8cdeb9c.274d28"]]},{"id":"cc322fa5.30b1b","type":"debug","z":"5675c6cf.d139e8","name":"PwsID/Key set","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":960,"y":240,"wires":[]}]

Flow Info

Created 3 years, 10 months ago
Rating: 5 1

Actions

Rate:

Node Types

Core
  • comment (x5)
  • debug (x4)
  • function (x4)
  • http request (x1)
  • inject (x4)
Other
  • tab (x1)

Tags

  • WU
  • Weatherunderground
  • Weather
  • TWC
  • Wunderground
  • Underground
  • PWS
  • Sensors
  • Arduino
  • Pi
  • Raspberry
  • Envrioment
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option