Travel Notifications

So I would like to setup notifications in node red for my wife and myself cars/phones. I have it in HA when I added in some zones and stuff but I would really like to do it in HA. I found someone who did exactly what I want but they are not sharing their flow just images which doesnt help me with all the pulling friendly names and all that (I am still a bit of a noob at NR but I'm getting better). Can anyone share their code for a flow if they have one? Thanks.

Not sure from your description how you intend that to work... but I have something similar....

5 minutes before leaving home > work & work > home, the flow calls the google maps api, to query the travel time between the 2 locations.
This is formatted to an email which warns about increased travel times.

I can't share the full flow because the google api key is hard coded, but the contents of the function node is; = ""; = "";
msg.topic = "Travel Update";
var route = msg.payload.routes[0].summary;
var durationValue = msg.payload.routes[0].legs[0].duration.value;
var duration = msg.payload.routes[0].legs[0].duration.text;
if (durationValue > 2100) {
    var text2 = "<br> This journey is taking longer than normal!! Check <a href=\,+Barnby+Dun,+Doncaster+DN3+1PP,+UK/Moorhead+Way,+Bramley,+Rotherham/@53.4977107,-1.2899287,11z/data=!4m13!412!1m5!1m1!1s0x487917da09c95:0x294e90cde4583477!2m2!1d-1.0656456!2d53.5728961!1m5!1m1!1s0x4879751c65ef3f63:0xb9c2c3fbc77!2m2!1d-1.2656!2d53.422668\">Google Maps</a> to see what the problem is and select a better route.";
    msg.topic = "**TRAVEL ALERT**";
} else {
    var text2 = "<br> Drive Safely!!";
var text3 = ("<br><br>Route updated at "+msg.mytime+" on "+msg.mydate);
msg.payload = ("Your route to work via <b>"+route+"</b> will take <b>"+duration+"</b>"+text2+text3);

return msg;

Hope this helps!

Thanks Paul, this is more what I was looking at doing.

It just pushes all zone changes to a device using notify, which is exactly what I want. It looks a lot simpler to me (at least).

I don't use HA, so can't help further. Good luck!

1 Like

Oh it’s a node red flow but yes inside of HA which I use.