Get tweets with a specific "#" - words are not necessary - Twitter give us the location of the tweet. With it we use http://www.findlatitudeandlongitude.com to get the coordinates for the specific city of the user. It returns latitude and longitude in an array, we convert to float and get the payloads [0] and [1] representing latitude and longitude we sent. After it we send the data to Weather Insights, it returns a JSON, this case we want just the temperature: msg.observation.metric.temp Note: I also change the node function to re-tweet to the person who asked the information.
-
-
Save priscillaparodi/f074d6af581cfb49db53f3fa2c90e721 to your computer and use it in GitHub Desktop.
Get Twitter Lat. and Lon. of a tweet, interprets with Weather Insights and tweet the actual temperature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"f8c57383.3f8338","type":"html","z":"1556b725.384cc1","name":"","tag":"#lat_dec span.value, #lon_dec span.value","ret":"text","as":"single","x":575,"y":158,"wires":[["de80fbaf.5a2a1"]]},{"id":"de80fbaf.5a2a1","type":"function","z":"1556b725.384cc1","name":"","func":"msg.newpayload = parseFloat(msg.payload[0]) + \",\" + parseFloat(msg.payload[1]);\n\nreturn msg","outputs":1,"noerr":0,"x":860,"y":158,"wires":[["2113e957.99ae9e"]]},{"id":"2113e957.99ae9e","type":"change","z":"1556b725.384cc1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"newpayload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":211,"y":310,"wires":[["13fb04bf.be77b3"]]},{"id":"13fb04bf.be77b3","type":"weather_insights","z":"1556b725.384cc1","name":"","service":"/api/weather/v2/observations/current","geocode":"","units":"m","language":"en-US","x":442,"y":308,"wires":[["f6134782.1b3178"]]},{"id":"f6134782.1b3178","type":"function","z":"1556b725.384cc1","name":"","func":"msg.payload= \"@\" + msg.topic.slice(7,30) + \" Temperature of your location: \" + msg.observation.metric.temp;\nreturn msg;","outputs":1,"noerr":0,"x":647,"y":314,"wires":[["19ede94d.b91b17"]]},{"id":"62794ee0.7da218","type":"twitter in","z":"1556b725.384cc1","twitter":"","tags":"pp_temp","user":"false","name":"pp_temp","topic":"tweets","x":117,"y":159,"wires":[["5592dd40.3d33ac"]]},{"id":"5592dd40.3d33ac","type":"http request","z":"1556b725.384cc1","name":"long and lat","method":"GET","ret":"txt","url":"http://www.findlatitudeandlongitude.com/?loc={{location.place}}","x":293,"y":159,"wires":[["f8c57383.3f8338"]]},{"id":"19ede94d.b91b17","type":"twitter out","z":"1556b725.384cc1","twitter":"","name":"Tweet","x":824,"y":323,"wires":[]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment