River height to emoncms

Takes river height data from the enviroment agency, parses the json then posts it to my emoncms dashboard.

[{"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"]]}]

Flow Info

Created 9 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • function (x1)
  • http request (x2)
  • inject (x1)
  • json (x1)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option