Update Dynamic DNS service when IP address changes

Thanks to Paul Reed and his Alert flow for inspiration.

This flow is built from Paul's, but adds IP persistence via Firebase and sends a Dynamic DNS update request when the IP changes.

To use this flow, you'll need to update :

  • the Firebase nodes with your own Firebase
  • the Dynamic DNS request with your own DynDNS service (it's ready to go for Zoneedit)
  • the Pushbullet alerter (you can also replace these components completely)

You'll also want to install the Firebase nodes at https://github.com/hovissimo/node-red-firebase

[{"id":"1ebdf0d7.2d9b07","type":"inject","name":"Get IP","topic":"ip","payload":"eth0","payloadType":"none","repeat":"","crontab":"","once":false,"x":107,"y":88,"z":"1f36db45.8970fd","wires":[["cca26044.5f4bb"]]},{"id":"cca26044.5f4bb","type":"exec","command":"wget -qO- http://bot.whatismyipaddress.com/ ; echo","append":"","useSpawn":"","name":"Call IP - whatismyipaddress.com","x":316,"y":88.5,"z":"1f36db45.8970fd","wires":[["245359e.76f6ca6"],[],[]]},{"id":"245359e.76f6ca6","type":"switch","name":"Integrity check","property":"payload","rules":[{"t":"regex","v":"\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"},{"t":"else"}],"checkall":"true","outputs":2,"x":560,"y":76.5,"z":"1f36db45.8970fd","wires":[["76711b7c.f840a4"],[]]},{"id":"e630e700.dbad98","type":"firebase query","name":"","firebaseurl":"https://foo.firebaseio.com/nodered/home/ip","child":"","x":295,"y":170,"z":"1f36db45.8970fd","wires":[["3eb1f234.5872ee"]]},{"id":"76711b7c.f840a4","type":"change","action":"replace","property":"newip","from":"","to":"msg.payload","reg":false,"name":"","x":136,"y":169,"z":"1f36db45.8970fd","wires":[["e630e700.dbad98"]]},{"id":"3eb1f234.5872ee","type":"function","name":"Swallow unchanged IP message","func":"var lastip = msg.payload;\nvar currentip = msg.newip;\n\nif (lastip != currentip) {\n\tmsg.payload = currentip;\n\treturn msg;\n}","outputs":1,"x":510,"y":171,"z":"1f36db45.8970fd","wires":[["a0b2a0db.ec598","9aa435b8.90d83"]]},{"id":"a0b2a0db.ec598","type":"firebase modify","name":"","firebaseurl":"https://foo.firebaseio.com/nodered/home/ip","child":"","method":"set","x":634,"y":230,"z":"1f36db45.8970fd","wires":[]},{"id":"9aa435b8.90d83","type":"http request","name":"Update zoneedit","method":"GET","url":"https://dynamic.zoneedit.com/auth/dynamic.html?host=www.example.com&dnsto={{newip}}","x":141,"y":251,"z":"1f36db45.8970fd","wires":[["4de4b2ba.43792c"]]},{"id":"4de4b2ba.43792c","type":"switch","name":"","property":"payload","rules":[{"t":"regex","v":"2\\d\\d"},{"t":"else"}],"checkall":"false","outputs":2,"x":321,"y":251,"z":"1f36db45.8970fd","wires":[["49808a0.6c53878"],["ae807305.81d1b"]]},{"id":"ae807305.81d1b","type":"pushbullet","title":"","name":"Nexus 5","x":450,"y":271,"z":"1f36db45.8970fd","wires":[]},{"id":"49808a0.6c53878","type":"file","name":"","filename":"dyndns.log","appendNewline":true,"overwriteFile":false,"x":460,"y":232,"z":"1f36db45.8970fd","wires":[]},{"id":"cf4c1d92.14fe3","type":"comment","name":"Inspired by Paul Reed's IP alert flow","info":"See Paul's at http://flows.nodered.org/flow/9559f217b08913702c38","x":344,"y":33,"z":"1f36db45.8970fd","wires":[]}]
hovissimo

Flow Info

created 3 years, 3 months ago

Node Types

Core
  • change (x1)
  • comment (x1)
  • exec (x1)
  • file (x1)
  • function (x1)
  • http request (x1)
  • inject (x1)
  • switch (x2)
Other

Tags

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