Would like a WR31 to send IP address if changed to SMS using Python (Clueless will pay $)

I would like my Digi Transport WR31 to send a text message to my phone when the IP address has changed using a Python script, I am clueless on writing in Python!

Willing to pay for Python script that will accomplish this task.

Thanks

Hi

Here is a simple piece of code that should work

you will need to include your phone number

from BaseWizard import write_cli
from time import sleep

PhoneNumber = “”

Old_IP = “0.0.0.0”

def get_ip() :
–getip = write_cli(“at\mibs=gprs.0.stats.ip”)
–splitip = getip.split()
–return splitip[2]

while True :

–New_IP = get_ip()
–if (New_IP==“OK”) or (New_IP==“0.0.0.0”) :
----print “Waiting for IP Address [”+New_IP+“]”

–elif (New_IP == Old_IP) :
----print “waiting for IP to Change [”+New_IP+“]”

–else:
----print “Changed to [” + New_IP +“]”
----result=write_cli(‘sendsms ‘+PhoneNumber+’ "SITE 1 new IP [’+New_IP+‘]"’)
----SMS_result = result.strip()
----print SMS_result
----Old_IP = New_IP

–sleep(5)

not sure why i have had to change spaces to “-”

1 Like

Works great, How much do I owe you for script?

Thank You!

Its a simple script enjoy

Recently the script quit working, after update to 6.0.0.6 I realized. had to add a sleep command at beginning of script to delay start.

seems to work but I’m no coder…LOL