Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
2 lines (1 sloc) 16.5 KB
[{"id":"b8707c72.21c5e","type":"http response","z":"9be35eb.5f31ba","name":"","x":1573.5001525878906,"y":2299.25,"wires":[]},{"id":"73448289.1bbc2c","type":"function","z":"9be35eb.5f31ba","name":"Return HTML header","func":"msg.headers = {'content-type': 'text/html'};\nreturn msg;\n","outputs":1,"noerr":0,"x":1398.5001525878906,"y":2335.5,"wires":[["b8707c72.21c5e"]]},{"id":"fc3dfb1e.9dc4f","type":"http request","z":"9be35eb.5f31ba","name":"","method":"GET","ret":"obj","url":"","tls":"","x":595.0000305175781,"y":2304.75,"wires":[["795cf7cd.e78838"]]},{"id":"4e092847.2b10a8","type":"function","z":"9be35eb.5f31ba","name":"","func":"msg.url = 'https://twcservice.mybluemix.net:443/api/weather/v1/location/'+\nmsg.payload.zipcode+':4:US/almanac/daily.json?units=e&start='+\nmsg.payload.start+'&end='+msg.payload.end;\nreturn msg;\n","outputs":1,"noerr":0,"x":451.0000305175781,"y":2304.75,"wires":[["fc3dfb1e.9dc4f"]]},{"id":"c5a8148b.20665","type":"http in","z":"9be35eb.5f31ba","name":"","url":"/almanac","method":"get","swaggerDoc":"","x":308.0000305175781,"y":2305.25,"wires":[["4e092847.2b10a8"]]},{"id":"1538d5b5.17e24a","type":"template","z":"9be35eb.5f31ba","name":"Display Alamanac Results","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<h1>Almanac for zip {{req.query.zipcode}}</h1>\n<table border=\"1\">\n <tr>\n <td>Date</td>\n <td>Avg Low</td>\n <td>Avg Hi</td>\n <td>Record Low (year)</td>\n <td>Record Hi (year)</td> \n <td>Mean Temperature</td>\n <td>Precipitation</td>\n <td>Snowfall</td>\n </tr>\n {{#payload.almanac_summaries}}\n <tr>\n <td>{{almanac_dt}}</td>\n <td>{{avg_lo}}</td>\n <td>{{avg_hi}}</td>\n <td>{{record_lo}} ({{record_lo_yr}})</td> \n <td>{{record_hi}} ({{record_hi_yr}})</td> \n <td>{{mean_temp}}</td>\n <td>{{avg_precip}}</td>\n <td>{{avg_snow}}</td>\n </tr>\n {{/payload.almanac_summaries}}\n</table>\n","x":1165.5000305175781,"y":2374.5,"wires":[["73448289.1bbc2c"]]},{"id":"795cf7cd.e78838","type":"switch","z":"9be35eb.5f31ba","name":"Return JSON?","property":"req.query.format","propertyType":"msg","rules":[{"t":"eq","v":"json","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":774.5000305175781,"y":2305.5,"wires":[["b8707c72.21c5e"],["801a7968.fdc43"]]},{"id":"801a7968.fdc43","type":"switch","z":"9be35eb.5f31ba","name":"Got Data?","property":"payload.metadata.status_code","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"else"}],"checkall":"false","outputs":2,"x":953.0000305175781,"y":2341.75,"wires":[["1b89c37c.3f745d"],["1538d5b5.17e24a"]]},{"id":"1b89c37c.3f745d","type":"template","z":"9be35eb.5f31ba","name":"Error","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Unable to get almanac data.\n","x":1105.0000305175781,"y":2335.75,"wires":[["73448289.1bbc2c"]]},{"id":"2d494c2e.ba230c","type":"http request","z":"9be35eb.5f31ba","name":"","method":"GET","ret":"obj","url":"","tls":"","x":595.0000305175781,"y":2026.75,"wires":[["d02fc1cd.2ffa08"]]},{"id":"d67eedee.60315","type":"function","z":"9be35eb.5f31ba","name":"","func":"msg.url = 'https://twcservice.mybluemix.net:443/api/weather/v1/location/'+msg.payload.zipcode+':4:US/forecast/hourly/48day.json?units=e';\nreturn msg;\n","outputs":1,"noerr":0,"x":451.0000305175781,"y":2026.75,"wires":[["2d494c2e.ba230c"]]},{"id":"b4360ff7.320f98","type":"http in","z":"9be35eb.5f31ba","name":"","url":"/forecast","method":"get","swaggerDoc":"","x":308.0000305175781,"y":2027.25,"wires":[["d67eedee.60315"]]},{"id":"d02fc1cd.2ffa08","type":"switch","z":"9be35eb.5f31ba","name":"Return JSON?","property":"req.query.format","propertyType":"msg","rules":[{"t":"eq","v":"json","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":795.0000305175781,"y":2026.75,"wires":[["dddb7082.2dcca"],["27223912.0caa7e"]]},{"id":"230031fa.7941fe","type":"template","z":"9be35eb.5f31ba","name":"Display Forecast","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<table border=\"1\">\n <tr>\n <td>Day</td>\n <td>All Day</td>\n <td>Daytime</td>\n <td>Night</td>\n <td>Sunrise/sunset</td>\n </tr>\n {{#payload.forecasts}}\n <tr>\n <td>{{dow}}</td>\n <td>{{narrative}}<br />Low: {{min_temp}}F Hi: {{max_temp}}F</td>\n <td>{{day.narrative}}<br /></td>\n <td>{{night.narrative}}<br /></td>\n <td>Sunrise: {{sunrise}}<br />Sunset: {{sunset}}<br /></td>\n </tr>\n {{/payload.forecasts}}\n</table>\n","x":1165.5000305175781,"y":2104.5,"wires":[["400e6703.862918"]]},{"id":"27223912.0caa7e","type":"switch","z":"9be35eb.5f31ba","name":"Got Data?","property":"payload.metadata.status_code","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"else"}],"checkall":"false","outputs":2,"x":968.0000305175781,"y":2072.75,"wires":[["59553bd.a411fc4"],["230031fa.7941fe"]]},{"id":"59553bd.a411fc4","type":"template","z":"9be35eb.5f31ba","name":"Error","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Unable to get forecast.\n","x":1124.0000305175781,"y":2066.75,"wires":[["400e6703.862918"]]},{"id":"66045e68.a3d8a8","type":"http request","z":"9be35eb.5f31ba","name":"","method":"GET","ret":"obj","url":"","tls":"","x":603.0000305175781,"y":1884.75,"wires":[["28174a27.db31ae"]]},{"id":"13b2acc2.12e99b","type":"function","z":"9be35eb.5f31ba","name":"","func":"msg.url = 'https://twcservice.mybluemix.net:443/api/weather/v1/location/'+\nmsg.payload.zipcode+':4:US/observations.json?units=e';\nreturn msg;\n","outputs":1,"noerr":0,"x":467.0000305175781,"y":1884.75,"wires":[["66045e68.a3d8a8"]]},{"id":"dee8f3c3.e4e348","type":"http in","z":"9be35eb.5f31ba","name":"","url":"/conditions","method":"get","swaggerDoc":"","x":318.0000305175781,"y":1884.25,"wires":[["13b2acc2.12e99b"]]},{"id":"28174a27.db31ae","type":"switch","z":"9be35eb.5f31ba","name":"Return JSON?","property":"req.query.format","propertyType":"msg","rules":[{"t":"eq","v":"json","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":774.0001525878906,"y":1884.75,"wires":[["25c72976.fd5bc6"],["a3489c34.273b5"]]},{"id":"a3489c34.273b5","type":"switch","z":"9be35eb.5f31ba","name":"Got Data?","property":"payload.metadata.status_code","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"else"}],"checkall":"false","outputs":2,"x":945.000244140625,"y":1914.75,"wires":[["8eebee44.e1d428"],["f3835d9b.38a64"]]},{"id":"8eebee44.e1d428","type":"template","z":"9be35eb.5f31ba","name":"Error","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Unable to get current conditions.\n","x":1097.000244140625,"y":1908.75,"wires":[["1681ee64.76cc32"]]},{"id":"f3835d9b.38a64","type":"template","z":"9be35eb.5f31ba","name":"Display Current Conditions","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload.observation}}\n <h1>Weather at {{obs_name}}</h1>\n {{wx_phrase}} {{blunt_phrase}}<br />\n Temperature: {{temp}}*F (feels like {{feels_like}}*F)<br />\n Dew Point: {{dewPt}}<br />\n Heat Index: {{heat_index}}<br />\n Humidity: {{rh}}<br />\n Baraometric Pressure: {{pressure}}<br />\n Visibility: {{vis}}mi<br />\n Wind: {{wdir_cardinal}} {{wspd}}mph<br />\n Min/Max Temperature: {{min_temp}}*F/{{max_temp}}*F<br />\n Precipitation last 24 hours: {{precip_total}}<br />\n Precipitation last hour: {{precip_hrly}}<br />\n Snow last hour: {{snow_hrly}}<br />\n UV Index: {{uv_index}}<br />\n{{/payload.observation}}\n","x":1165.000244140625,"y":1950.75,"wires":[["1681ee64.76cc32"]]},{"id":"83a5c05e.be9498","type":"http request","z":"9be35eb.5f31ba","name":"","method":"GET","ret":"obj","url":"","tls":"","x":619.0000305175781,"y":2167.75,"wires":[["5c8b37f7.e7f87"]]},{"id":"cbfb50ab.e4c698","type":"function","z":"9be35eb.5f31ba","name":"","func":"msg.url = 'https://twcservice.mybluemix.net:443/api/weather/v1/location/'+\nmsg.payload.zipcode+':4:US/observations/timeseries.json?units=e&hours='+\nmsg.payload.hours;\nreturn msg;\n","outputs":1,"noerr":0,"x":475.0000305175781,"y":2167.75,"wires":[["83a5c05e.be9498"]]},{"id":"922a4089.765b08","type":"http in","z":"9be35eb.5f31ba","name":"","url":"/timeseries","method":"get","swaggerDoc":"","x":318.0000305175781,"y":2167.25,"wires":[["cbfb50ab.e4c698"]]},{"id":"5c8b37f7.e7f87","type":"switch","z":"9be35eb.5f31ba","name":"Return JSON?","property":"req.query.format","propertyType":"msg","rules":[{"t":"eq","v":"json","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":795.0000305175781,"y":2167.75,"wires":[["fcef2874.2c0278"],["d993af0.4bc17d"]]},{"id":"d993af0.4bc17d","type":"switch","z":"9be35eb.5f31ba","name":"Got Data?","property":"payload.metadata.status_code","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"else"}],"checkall":"false","outputs":2,"x":970.0000305175781,"y":2204.75,"wires":[["ad368976.3c2a8"],["306784ee.e9c85c"]]},{"id":"ad368976.3c2a8","type":"template","z":"9be35eb.5f31ba","name":"Error","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Unable to get timeseries conditions.\n","x":1116.0000305175781,"y":2197.75,"wires":[["1c580f66.3992f1"]]},{"id":"189d23fb.ed51bc","type":"template","z":"9be35eb.5f31ba","name":"Display Time Series","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload.observations}}\n <h1>Weather for {{obs_name}} at {{time}}</h1>\n {{wx_phrase}} {{blunt_phrase}}<br />\n Temperature: {{temp}}*F (feels like {{feels_like}}*F)<br />\n Dew Point: {{dewPt}}<br />\n Heat Index: {{heat_index}}<br />\n Humidity: {{rh}}<br />\n Barometric Pressure: {{pressure}}<br />\n Visibility: {{vis}}mi<br />\n Wind: {{wdir_cardinal}} {{wspd}}mph<br />\n Min/Max Temperature: {{min_temp}}*F/{{max_temp}}*F<br />\n Precipitation last 24 hours: {{precip_total}}<br />\n Precipitation last hour: {{precip_hrly}}<br />\n Snow last hour: {{snow_hrly}}<br />\n UV Index: {{uv_index}}<br />\n{{/payload.observations}}\n","x":1304.9999084472656,"y":2236.75,"wires":[["1c580f66.3992f1"]]},{"id":"30efa921.e7e326","type":"http in","z":"9be35eb.5f31ba","name":"","url":"/alerts","method":"get","swaggerDoc":"","x":298.0000305175781,"y":1636.75,"wires":[["18beef1f.637d61"]]},{"id":"18beef1f.637d61","type":"function","z":"9be35eb.5f31ba","name":"","func":"msg.url = 'https://twcservice.mybluemix.net/api/weather/v1/country/US/state/'+\nmsg.payload.state+'/alerts.json?language=en-US';\nreturn msg;\n","outputs":1,"noerr":0,"x":437.0000305175781,"y":1637.25,"wires":[["7680e970.0cce5"]]},{"id":"7680e970.0cce5","type":"http request","z":"9be35eb.5f31ba","name":"","method":"GET","ret":"obj","url":"","tls":"","x":581.0000305175781,"y":1637.25,"wires":[["f3acde86.fbd028"]]},{"id":"f3acde86.fbd028","type":"switch","z":"9be35eb.5f31ba","name":"Return JSON?","property":"req.query.format","propertyType":"msg","rules":[{"t":"eq","v":"json","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":753.5000305175781,"y":1637.5,"wires":[["f7df5157.f22778"],["43ac4099.a7319"]]},{"id":"43ac4099.a7319","type":"switch","z":"9be35eb.5f31ba","name":"Got Data?","property":"payload.metadata.status_code","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"else"}],"checkall":"false","outputs":2,"x":929.5000305175781,"y":1665.5,"wires":[["945fd04a.ee0a2"],["8e0c84b6.38bd5"]]},{"id":"945fd04a.ee0a2","type":"template","z":"9be35eb.5f31ba","name":"Error","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Unable to get alerts for state.","x":1079.5000305175781,"y":1658.75,"wires":[["1fe581da.1ab436"]]},{"id":"8e0c84b6.38bd5","type":"template","z":"9be35eb.5f31ba","name":"Display Alerts For State","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<h2>Weather Alerts</h2>\n\n{{#payload.alerts}}\n <div>\n <h3><a href=\"/alert?id={{key}}\">{{headline_text}}</a></h3>\n <p>{{area_name}}</p>\n </div>\n{{/payload.alerts}}","x":1140.0000305175781,"y":1696.25,"wires":[["1fe581da.1ab436"]]},{"id":"1fe581da.1ab436","type":"function","z":"9be35eb.5f31ba","name":"Return HTML header","func":"msg.headers = {'content-type': 'text/html'};\nreturn msg;\n","outputs":1,"noerr":0,"x":1376.0000305175781,"y":1658.25,"wires":[["f7df5157.f22778"]]},{"id":"f7df5157.f22778","type":"http response","z":"9be35eb.5f31ba","name":"","x":1562.0000305175781,"y":1626,"wires":[]},{"id":"caf8e2d3.880d98","type":"http in","z":"9be35eb.5f31ba","name":"","url":"/alert","method":"get","swaggerDoc":"","x":298.0000305175781,"y":1762.61669921875,"wires":[["9dbe0946.d7fe58"]]},{"id":"9dbe0946.d7fe58","type":"function","z":"9be35eb.5f31ba","name":"","func":"msg.url = 'https://twcservice.mybluemix.net/api/weather/v1/alert/'+\nmsg.payload.id+'/details.json?language=en-US';\nreturn msg;\n","outputs":1,"noerr":0,"x":437.0000305175781,"y":1763.11669921875,"wires":[["6cb567b3.8ee9f8"]]},{"id":"6cb567b3.8ee9f8","type":"http request","z":"9be35eb.5f31ba","name":"","method":"GET","ret":"obj","url":"","tls":"","x":581.0000305175781,"y":1763.11669921875,"wires":[["6bda8d7c.7adea4"]]},{"id":"6bda8d7c.7adea4","type":"switch","z":"9be35eb.5f31ba","name":"Return JSON?","property":"req.query.format","propertyType":"msg","rules":[{"t":"eq","v":"json","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":753.5000305175781,"y":1763.36669921875,"wires":[["b23ab383.b5e018"],["c80c1525.bda73"]]},{"id":"c80c1525.bda73","type":"switch","z":"9be35eb.5f31ba","name":"Got Data?","property":"payload.metadata.status_code","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"else"}],"checkall":"false","outputs":2,"x":929.5000305175781,"y":1791.36669921875,"wires":[["1cc6b377.c61445"],["1061dd17.82b483"]]},{"id":"1cc6b377.c61445","type":"template","z":"9be35eb.5f31ba","name":"Error","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Unable to get alerts for state.","x":1079.5000305175781,"y":1784.61669921875,"wires":[["e71f302a.6161e"]]},{"id":"e71f302a.6161e","type":"function","z":"9be35eb.5f31ba","name":"Return HTML header","func":"msg.headers = {'content-type': 'text/html'};\nreturn msg;\n","outputs":1,"noerr":0,"x":1376.0000305175781,"y":1784.11669921875,"wires":[["b23ab383.b5e018"]]},{"id":"1061dd17.82b483","type":"template","z":"9be35eb.5f31ba","name":"Display Alert Details","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload.alertDetail}}\n <h2>{{headline_text}}</h2>\n {{#texts}}\n <p>{{description}}</p>\n <p>{{instruction}}</p>\n {{/texts}}\n\n <p>Issued by {{source}} - {{office_name}}, {{office_cd}}</p>\n{{/payload.alertDetail}}\n","x":1128.6333312988281,"y":1822.25,"wires":[["e71f302a.6161e"]]},{"id":"b23ab383.b5e018","type":"http response","z":"9be35eb.5f31ba","name":"","x":1562.0000305175781,"y":1751.86669921875,"wires":[]},{"id":"1681ee64.76cc32","type":"function","z":"9be35eb.5f31ba","name":"Return HTML header","func":"msg.headers = {'content-type': 'text/html'};\nreturn msg;\n","outputs":1,"noerr":0,"x":1409.8667602539062,"y":1910.0833129882812,"wires":[["25c72976.fd5bc6"]]},{"id":"25c72976.fd5bc6","type":"http response","z":"9be35eb.5f31ba","name":"","x":1595.8667602539062,"y":1877.8333129882812,"wires":[]},{"id":"400e6703.862918","type":"function","z":"9be35eb.5f31ba","name":"Return HTML header","func":"msg.headers = {'content-type': 'text/html'};\nreturn msg;\n","outputs":1,"noerr":0,"x":1384.2334289550781,"y":2067.75,"wires":[["dddb7082.2dcca"]]},{"id":"dddb7082.2dcca","type":"http response","z":"9be35eb.5f31ba","name":"","x":1566.2334289550781,"y":2023.75,"wires":[]},{"id":"1c580f66.3992f1","type":"function","z":"9be35eb.5f31ba","name":"Return HTML header","func":"msg.headers = {'content-type': 'text/html'};\nreturn msg;\n","outputs":1,"noerr":0,"x":1508.9332580566406,"y":2195.750030517578,"wires":[["fcef2874.2c0278"]]},{"id":"fcef2874.2c0278","type":"http response","z":"9be35eb.5f31ba","name":"","x":1694.9332580566406,"y":2160.500030517578,"wires":[]},{"id":"306784ee.e9c85c","type":"function","z":"9be35eb.5f31ba","name":"Add Time","func":"msg.payload.observations = msg.payload.observations.map(function(observation) {\n observation.time = new Date(observation.valid_time_gmt*1000).toString();\n return observation; \n});\n\nreturn msg;\n","outputs":1,"noerr":0,"x":1121.7833557128906,"y":2236.9000244140625,"wires":[["189d23fb.ed51bc"]]}]