Home/Support/Support Forum/Would like a WR31 to send IP address if changed to SMS using Python (Clueless will pay $)
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

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

0 votes
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.

asked May 23, 2017 in Python by Bryonhu Seasoned Professional (195 points)

Please log in or register to answer this question.

1 Answer

+1 vote

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 = "<Phone Number HERE>"

Old_IP = ""

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=="") :
----print "Waiting for IP Address ["+New_IP+"]"

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

----print "Changed to [" + New_IP +"]"
----result=write_cli('sendsms '+PhoneNumber+' "SITE 1 new IP "')
----SMS_result = result.strip()
----print SMS_result
----Old_IP = New_IP


not sure why i have had to change spaces to "-"
answered May 24, 2017 by James.Wilson Veteran of the Digi Community (1,227 points)
edited May 24, 2017 by James.Wilson
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 I realized. had to add a sleep command at beginning of script to delay start.

seems to work but I'm no coder...LOL