Home/Support/Support Forum/Send SMS every 24 hours
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Send SMS every 24 hours

0 votes
Hi,

I need the Digi Connect WAN 3G to send an SMS to a number every 24 hours. I've written a python script to do this, and while sending the SMS from the script isn't a problem, getting it to repeat is.

There isn't any cron functionality on the device so I'm left with the option to do this using Python.

This is the script:
==================================================
Code:
import digisms import threading import time addr=xxxxxxxxxxx msg="Ping from "+addr class RepeatEvery(threading.Thread): def __init__(self, interval, func, *args, **kwargs): threading.Thread.__init__(self) self.interval = interval # seconds between calls self.func = func # function to call self.args = args # optional positional argument(s) for call self.kwargs = kwargs # optional keyword argument(s) for call self.runable = True def run(self): while self.runable: self.func(*self.args, **self.kwargs) time.sleep(self.interval) def stop(self): self.runable = False def sendMessage(): digisms.send(addr, msg) thread = RepeatEvery(30, sendMessage) thread.start()
==================================================

The number in addr would normally be a complete phone number, but it's been censored for privacy sake.

When I run this, it locks up the Digi Connect 3G and kills my SSH session, and no messages are sent.

Does anyone know how I can configure the Digi Connect 3G to send an SMS message every 24 hours?
asked Oct 22, 2014 in Python by mchalec New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
You need to factor this in if you haven't already:
http://www.digi.com/wiki/developer/index.php/Digi_Python_Programmer%27s_Guide#thread_and_threading
answered Oct 27, 2014 by kjensen8 Veteran of the Digi Community (653 points)
...