Pull Public IP address and Email any changes
This flow checks regularly for the public IP address of the network it is running on. It checks every minute if the ip address is the same as it was for the previous minute. if the ip address is the same as before the node exits and if the ip address has changed it will send an email with the new ip address to my own email address (i use my personal gmail using the smtp which is easy enough to setup). I also have a method setup to check if a email exists in a specific email box, then if that email contains the letters "ip" it will check the public IP address and forward an email to the same box as above with the current public ip address. I set all this up because I use Wireguard to access my home network. I am not paying for a private IP address from my ISP and they can and do change the public ip address from time to time. If i am out of the house I want to know if my address has changed and where I need to connect to using Wireguard. I know that dynamic dns is a solution I could use to make this happen but I didn't want to figure out how to set that up when I implemented this solution. It has worked pretty well without any issues so far. This flow has tolkens and my email address removed.
[{"id":"2db4cecdb751304d","type":"public-ip-address","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"get ip address","x":620,"y":500,"wires":[["567db6d7445889ea","7a89b51ffe07a1b0"]]},{"id":"567db6d7445889ea","type":"switch","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"Check for same IP address","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"prev"},{"t":"neq","v":"","vt":"prev"}],"checkall":"true","repair":false,"outputs":2,"x":900,"y":500,"wires":[["0babf78aa7632928"],["65a08353522d481d","ebd57685d91e8288"]]},{"id":"7683db6750b64486","type":"cron","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"","crontab":"* * * * *","x":290,"y":400,"wires":[["2db4cecdb751304d"]]},{"id":"0babf78aa7632928","type":"debug","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"debug 12","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1100,"y":360,"wires":[]},{"id":"7a89b51ffe07a1b0","type":"debug","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"debug 13","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":380,"wires":[]},{"id":"65a08353522d481d","type":"debug","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"debug 15","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1120,"y":620,"wires":[]},{"id":"bbe05494e06ad2fc","type":"e-mail","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","server":"smtp.gmail.com","port":"465","authtype":"BASIC","saslformat":true,"token":"useyourown","secure":true,"tls":false,"name":"useyourown","dname":"","x":1440,"y":580,"wires":[]},{"id":"ebd57685d91e8288","type":"function","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"function 1","func":"msg.payload += \" is your home IP address\"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":520,"wires":[["bbe05494e06ad2fc"]]},{"id":"9aa027bc50dd5644","type":"e-mail in","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"","protocol":"IMAP","server":"imap.gmail.com","useSSL":true,"autotls":"never","port":"993","authtype":"BASIC","saslformat":true,"token":"useyourown","box":"Node-Red","disposition":"None","criteria":"ALL","repeat":"60","fetch":"auto","inputs":0,"x":190,"y":660,"wires":[["0877bfb4e6fc42f5","c6cf8a6f50ae1d33"]]},{"id":"a5d2ad5ca90072ae","type":"change","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":800,"wires":[["d09f4fb3bca3cd25"]]},{"id":"b5fcaa9ba0f450a6","type":"e-mail","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","server":"smtp.gmail.com","port":"465","authtype":"BASIC","saslformat":true,"token":"useyourown","secure":true,"tls":false,"name":"useyourown","dname":"","x":1100,"y":780,"wires":[]},{"id":"d09f4fb3bca3cd25","type":"public-ip-address","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"","x":880,"y":640,"wires":[["b5fcaa9ba0f450a6"]]},{"id":"0877bfb4e6fc42f5","type":"debug","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"debug 16","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":560,"wires":[]},{"id":"9b9dcd4991319d59","type":"debug","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"debug 17","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":660,"wires":[]},{"id":"c6cf8a6f50ae1d33","type":"function","z":"20d2d42246c2d332","g":"7e1d4a55d6ab692e","name":"function 2","func":"// Check if msg.payload is an array and contains at least one item\nif (Array.isArray(msg.payload) && msg.payload.length > 0) {\n // Extract the HTML content from the first item of the array\n var htmlContent = msg.payload[0].html;\n\n // Check if the HTML content is a string and contains the string \"ip\"\n if (typeof htmlContent === 'string' && htmlContent.includes(\"ip\")) {\n // If \"ip\" is found in the HTML content, trigger flows accordingly\n node.send({ payload:\"triggered\"});\n }\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":740,"wires":[["a5d2ad5ca90072ae","9b9dcd4991319d59"]]}]