Skip to content

Instantly share code, notes, and snippets.

@pevandenburie
Created March 3, 2016 21:04
Show Gist options
  • Save pevandenburie/022a94f5bf0003b2d9d5 to your computer and use it in GitHub Desktop.
Save pevandenburie/022a94f5bf0003b2d9d5 to your computer and use it in GitHub Desktop.
[{"id":"3d33a278.c2cc5e","type":"subflow","name":"Subflow 1","info":"","in":[{"x":-10,"y":373,"wires":[{"id":"8e386c16.71c79"}]}],"out":[{"x":475,"y":376,"wires":[{"id":"ce58d70f.31a728","port":0}]}]},{"id":"ce58d70f.31a728","type":"function","z":"3d33a278.c2cc5e","name":"parse","func":"\nvar city = msg.payload.query.results.channel.location.city;\nvar country = msg.payload.query.results.channel.location.country;\nvar forecast = msg.payload.query.results.channel.item.forecast;\n\nvar line1 = \"1:\"+city+\" (\"+country+\")\";\nvar line2 = \"2:\"+forecast[0].day+\": \"+forecast[0].text;\nvar line3 = \"3:\"+forecast[1].day+\": \"+forecast[1].text;\nvar line4 = \"4:\"+forecast[2].day+\": \"+forecast[2].text;\n\n//clear the screen and send the messages\nmsg.payload = \"clr:\";\nnode.send(msg);\nmsg.payload = line1;\nnode.send(msg);\nmsg.payload = line2;\nnode.send(msg);\nmsg.payload = line3;\nnode.send(msg);\nmsg.payload = line4;\nnode.send(msg);\n\n//return msg;","outputs":1,"noerr":0,"x":345,"y":376,"wires":[[]]},{"id":"8e386c16.71c79","type":"http request","z":"3d33a278.c2cc5e","name":"yahoo weather","method":"GET","ret":"obj","url":"https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22paris%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys","x":150,"y":373,"wires":[["ce58d70f.31a728"]]},{"id":"5f612d80.a09ed4","type":"subflow:3d33a278.c2cc5e","z":"2a19294d.d5e6d6","name":"yahooweather2screen","x":201.5,"y":468.5,"wires":[["fc1603fd.03ea"]]}]
@pevandenburie
Copy link
Author

The Node-RED subflow for yahoo weather processing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment