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

**URL:** <https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385>\
**Category:** Python\
**Tags:** ip, address, transport, on, a\
**Created:** [May 23, 2017, 1:14pm UTC](https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385 "2017-05-23T13:14:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryonhu](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@Bryonhu](https://forums.digi.com/u/Bryonhu)\
**Post date:** [May 23, 2017, 1:14pm UTC](https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385/1 "2017-05-23T13:14:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![James.Wilson](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@James.Wilson](https://forums.digi.com/u/James.Wilson)\
**Post date:** [May 24, 2017, 5:27am UTC](https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385/2 "2017-05-24T05:27:26Z")

</div>

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 “-”

---

<div class="post-metadata">

**Author:** ![Bryonhu](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@Bryonhu](https://forums.digi.com/u/Bryonhu)\
**Post date:** [May 31, 2017, 10:41am UTC](https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385/3 "2017-05-31T10:41:11Z")

</div>

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

Thank You!

---

<div class="post-metadata">

**Author:** ![James.Wilson](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@James.Wilson](https://forums.digi.com/u/James.Wilson)\
**Post date:** [July 3, 2017, 11:22am UTC](https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385/4 "2017-07-03T11:22:00Z")

</div>

Its a simple script enjoy

---

<div class="post-metadata">

**Author:** ![Bryonhu](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@Bryonhu](https://forums.digi.com/u/Bryonhu)\
**Post date:** [February 11, 2018, 1:47pm UTC](https://forums.digi.com/t/would-like-a-wr31-to-send-ip-address-if-changed-to-sms-using-python-clueless-will-pay/18385/5 "2018-02-11T13:47:32Z")

</div>

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
