Takes river height data from the enviroment agency, parses the json then posts it to my emoncms dashboard.
Last active
January 2, 2016 15:42
-
-
Save tinmantom/f5ca1bf2fbdc98a89aec to your computer and use it in GitHub Desktop.
River height to emoncms
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":"5dca64c8.c63cf4","type":"inject","z":"ad66b0c2.e851c8","name":"","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":true,"x":102,"y":74,"wires":[["78d11da7.d24b84"]]},{"id":"78d11da7.d24b84","type":"http request","z":"ad66b0c2.e851c8","name":"","method":"GET","ret":"obj","url":"http://environment.data.gov.uk/flood-monitoring/id/stations/4011.json","x":97,"y":153,"wires":[["ca82f976.78c8f"]]},{"id":"df9d76e0.243af8","type":"debug","z":"ad66b0c2.e851c8","name":"","active":true,"console":"true","complete":"payload","x":303.4444580078125,"y":496,"wires":[]},{"id":"a04ab3ea.dabad","type":"function","z":"ad66b0c2.e851c8","name":"","func":"var obj = JSON.parse(msg.payload);\nvar rates = obj.items.measures.latestReading.value; \n\n\nmsg.payload = rates*100;\n\nreturn msg;\n","outputs":1,"noerr":0,"x":377.8888888888889,"y":219.22222222222223,"wires":[["33ea8b1a.4b1a0c"]]},{"id":"ca82f976.78c8f","type":"json","z":"ad66b0c2.e851c8","name":"","x":303.44444444444446,"y":97,"wires":[["a04ab3ea.dabad"]]},{"id":"33ea8b1a.4b1a0c","type":"http request","z":"ad66b0c2.e851c8","name":"","method":"POST","ret":"txt","url":"http://emoncms.org/input/post.json?json={riverDerwent:{{{payload}}}}&apikey=[EMONCMS_API_KEY_HERE_WITHOUT_SQUARE_BRAQUETS]","x":462.3333435058594,"y":360.3333435058594,"wires":[["df9d76e0.243af8"]]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment