Alert if Public IP address changes
I wrote this flow to send me a push message (could be twitter, email, etc) if my home IP address changes.
My ISP issues dynamic IP addresses, so occasionally my broadband would encounter a problem, and a new IP address would be issued which triggers an alert, giving me the new IP address where I can access my home network (I must get a domain!!).
It can also give an indication of router/line problems, if the IP address changes too frequently.
The flow needs little explanation, it obtains your current public IP address via http://bot.whatismyipaddress.com/ but there are other services available - http://echoip.com/ and http://ipecho.net/plain and passes the result through a 'switch' node programmed only to accept data in the format of a IP address - regex validity check (thanks Nick). The IP address is then compared to the previous recorded IP address, and if they differ - then an alert is raised, otherwise the flow ends.
[{"id":"10febc52.c63164","type":"debug","z":"a444a9ff.e7a408","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":4830,"wires":[]},{"id":"24b6dbdd.881184","type":"exec","z":"a444a9ff.e7a408","command":"curl bot.whatismyipaddress.com","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Call IP - whatismyipaddress.com","x":430,"y":4780,"wires":[["5530cb08.8135e4"],[],[]]},{"id":"4adfd71d.23f778","type":"inject","z":"a444a9ff.e7a408","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":4780,"wires":[["24b6dbdd.881184"]]},{"id":"be3dc4cd.323588","type":"function","z":"a444a9ff.e7a408","name":"Compare IP","func":"context.lastip = context.lastip || 'initial';\nvar currentip = msg.payload;\n\nif (context.lastip == 'initial') {\ncontext.lastip = currentip;\n}\nelse if (context.lastip != currentip) {\nmsg.payload = \"My current IP is \"+currentip;\ncontext.lastip = currentip;\nreturn msg;\n}","outputs":1,"x":830,"y":4780,"wires":[["10febc52.c63164"]]},{"id":"5530cb08.8135e4","type":"switch","z":"a444a9ff.e7a408","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":660,"y":4780,"wires":[["be3dc4cd.323588"],[]]}]