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.

Thanks
asked May 23, 2017 in Python by Bryonhu Community Contributor (117 points)

Please log in or register to answer this question.

1 Answer

+1 vote
Hi

Here is a simple piece of code that should work

you will need to include your phone number

<code>
from BaseWizard import write_cli
from time import sleep

PhoneNumber = "<Phone Number HERE>"

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 "')
----SMS_result = result.strip()
----print SMS_result
----Old_IP = New_IP

--sleep(5)

not sure why i have had to change spaces to "-"
answered May 24, 2017 by James.Wilson Veteran of the Digi Community (1,225 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 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
...