Owntracks Geofence Notifications via Pushover

By subscribing to an mqtt topic on a broker where http://owntracks.org/ clients publish messages the message is then routed to pushover.net (see here for the additional node https://github.com/christoface/node-red-nodes/tree/master/social)

The flow includes testing inject nodes and debug nodes.

[{"id":"935915de.8aaf08","type":"mqtt-broker","broker":"10.0.1.10","port":"1883"},{"id":"3e2f6060.7495a","type":"mqtt in","name":"owntracks geofence","topic":"owntracks/#","broker":"935915de.8aaf08","x":153,"y":154,"z":"b4348802.41dcf","wires":[["2c9a5ef1.d3c942","a39036aa.cafa18"]]},{"id":"2c9a5ef1.d3c942","type":"debug","name":"","active":false,"complete":false,"x":503,"y":153,"z":"b4348802.41dcf","wires":[]},{"id":"46e9a84c.1ae098","type":"pushover","name":"","title":"Node-Red Message","message":"","priority":"-1","x":539,"y":432,"z":"b4348802.41dcf","wires":[]},{"id":"a39036aa.cafa18","type":"function","name":"","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n//   console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n//   context = {};\nvar now = Date();\nvar message = \"\";\ndata = JSON.parse(msg.payload);\n\nif ( (data._type == \"location\") && (data.event != undefined ) ) {\n\t\n\t\tif ( data.event == \"enter\" ) {\t\t\t\n\t\t\tmessage = \"Entering Location: \";\n\t\t} else {\n\t\t\tmessage = \"Leaving Location: \";\n\t\t}\n\t\t\n\t\tif ( data.desc != undefined ) {\n\t\t\t// Shared waypoint, comes with a description:\n\t\t\t\tmessage += data.desc;\n \t\t} else {\n \t\t\t// No description is set, non shared \"private\" waypoint\n \t\t\t\tmessage += data.lat + \",\" + data.lon;\n \t\t}\n }\n\nmsg.payload = message;\n//console.log(msg.payload);\n\nreturn msg;","outputs":1,"x":344,"y":278,"z":"b4348802.41dcf","wires":[["bdb0f75.03be688","1674ee6.d2ad912"]]},{"id":"bdb0f75.03be688","type":"switch","name":"","property":"payload","rules":[{"t":"cont","v":"Location"}],"checkall":"true","outputs":1,"x":505,"y":278,"z":"b4348802.41dcf","wires":[["46e9a84c.1ae098"]]},{"id":"1674ee6.d2ad912","type":"debug","name":"","active":true,"complete":false,"x":504,"y":206,"z":"b4348802.41dcf","wires":[]},{"id":"4bece82a.59fd58","type":"inject","name":"Test Shared Waypoint","topic":"","payload":"{\"_type\": \"location\", \"lat\": \"xxxx\", \"lon\": \"yyyy\", \"tst\": \"1391715492\", \"acc\": \"500.0\", \"batt\": \"48\", \"desc\": \"Shared Test Waypoint\", \"event\": \"enter\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":149,"y":278,"z":"b4348802.41dcf","wires":[["a39036aa.cafa18"]]},{"id":"53707bda.3750d4","type":"inject","name":"Test Private Waypoint","topic":"","payload":"{\"_type\": \"location\", \"lat\": \"xxxx\", \"lon\": \"yyyy\", \"tst\": \"1391715492\", \"acc\": \"500.0\", \"batt\": \"48\", \"event\": \"enter\"}","payloadType":"string","repeat":"","crontab":"","once":false,"x":148,"y":343,"z":"b4348802.41dcf","wires":[["a39036aa.cafa18"]]}]
juzam

Flow Info

created 3 years, 4 months ago

Node Types

Core
  • debug (x2)
  • function (x1)
  • inject (x2)
  • mqtt in (x1)
  • mqtt-broker (x1)
  • switch (x1)
Other

Tags

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