Simpler Earthquake Monitor

I started with the flow from deecjay and found it did not work for me.

So, I started anew:

Gets the earthquake report from USGS (all within the last hour) - and creates one message per quake with time, lat, lon, depth, magnitude, place and type (may not be an earthquake - but you can fix that).

The particular feed used is http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.csv there are plenty of others to play with - see http://earthquake.usgs.gov/earthquakes/feed/v1.0/

Sample message: { "time": "2015-10-05T03:13:25.000Z", "latitude": 60.2236, "longitude": -141.066, "mag": 1.4, "place": "77km ENE of Cape Yakataga, Alaska", "type": "earthquake" }

[{"type":"tab","id":"29609aca.d69f66","label":"USGS Earthquake Monitor"},{"id":"16616712.e99e99","type":"mqtt-broker","broker":"localhost","port":"1883"},{"id":"a9ecfe6f.5613","type":"http request","name":"","method":"GET","ret":"txt","url":"http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.csv","x":276,"y":54,"z":"29609aca.d69f66","wires":[["86781b39.7987e8"]]},{"id":"66f14749.990eb8","type":"debug","name":"","active":true,"complete":"false","x":619.0000610351562,"y":265.9999694824219,"z":"29609aca.d69f66","wires":[]},{"id":"cc40789.f33bf88","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"x":92,"y":53,"z":"29609aca.d69f66","wires":[["a9ecfe6f.5613"]]},{"id":"3bb724f.fc448dc","type":"function","name":"USGS Quake monitor Strip Disinteresting Data","func":"//node.warn(msg.payload);\n// \"time\", \"latitude\", \"longitude\", \"depth\", \"mag\", \"magType\", \"nst\", \"gap\", \"dmin\", \"rms\", \"net\", \"id\", \"updated\", \"place\", \"type\" \nvar out = {};\n\nif (msg.payload.depth) delete(msg.payload.depth);\nif (msg.payload.nst) delete(msg.payload.nst);\nif (msg.payload.gap) delete(msg.payload.gap);\nif (msg.payload.dmin) delete(msg.payload.dmin);\nif (msg.payload.magType) delete(msg.payload.magType);\nif (msg.payload.id) delete(msg.payload.id);\nif (msg.payload.updated) delete(msg.payload.updated);\nif (msg.payload.rms) delete(msg.payload.rms);\nif (msg.payload.net) delete(msg.payload.net);\nreturn [ msg ];","outputs":"1","noerr":0,"x":308,"y":265,"z":"29609aca.d69f66","wires":[["66f14749.990eb8"]]},{"id":"86781b39.7987e8","type":"csv","name":"CSV to JSON","sep":",","hdrin":true,"hdrout":"","multi":"one","ret":"\\n","temp":"\"time\", \"latitude\", \"longitude\", \"depth\", \"mag\", \"magType\", \"nst\", \"gap\", \"dmin\", \"rms\", \"net\", \"id\", \"updated\", \"place\", \"type\" ","x":282,"y":165,"z":"29609aca.d69f66","wires":[["3bb724f.fc448dc"]]}]

Flow Info

Created 9 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • csv (x1)
  • debug (x1)
  • function (x1)
  • http request (x1)
  • inject (x1)
  • mqtt-broker (x1)
Other
  • tab (x1)

Tags

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