Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By heckler
#66172 Hey Group,

So my ISP doesn't supply a fixed public IP address. It can change (especially if my DSL router is rebooted).

So I found that I can have an esp module obtain the current public IP addy and send it to me in an email message.
It would be easy to have an esp module check periodically if the Pub IP had changed (by doing a comparison current/last) and send a message to inform. That way you will always be able to get back in to your IOT/Smart devices.

example code...
Code: Select allmemclear
pubip = "empty"
button "Get IP", [GetIp]
wait

[GetIp]
pubip=wget(myip.dnsomatic.com)
print pubip
wait


cheers
dwight

PS
these url's all work...
http://myip.dnsomatic.com/
http://icanhazip.com/

this one works from a dos prompt...
nslookup myip.opendns.com. resolver1.opendns.com