In this tutorial we are going to see how to create notifications (and/or create actions) when an earthquake happens.

First off, add our MQTT broker to your Node-RED installation. After adding a mqtt input node, select “Add new mqtt-broker…”  and configure it like so:

..and our mqtt input node should look like this

You will also need a JSON node and a function node :

The JSON node will convert the string received from mqtt and the function node will filter the earthquakes so they are relevant to your area. Don’t forget to search our list for previous events in your area.

The function node will be a simple one for this example:

var location =
var mag =
if (location.toString() === “IONIAN SEA”){
msg.payload = “Earthquake alert! Magnitude: ” + mag
return msg;

By now, when an earthquake is detected the function node will trigger the next node (alert/action). I will use Pushbullet as a demonstration but you could use whatever you want. Install  and configure Pushbullet  on Node-RED for the next part.

Thats it!