Receive an SMS

In previous generations, the digisms Python module was used to receive SMS messages:

  1. Specify a handler to receive the SMS text message.
  2. Register a callback by invoking the Callback(handler) function.

In the new XBee gateways, the digidevice.sms Python module is used to receive SMS messages.:

  1. Specify a handler to receive the SMS text message.
  2. Register a callback by invoking the Callback(handler) function.
New API
from digidevice import sms
  
def sms_callback(sms):
    print("\nMessage from: %s" % sms['from'])
    print("====================")
    print(sms['message'])
    print("====================")
  
# Register the SMS callback
my_callback = sms.Callback(sms_callback)
# Leave the program executing
input()
my_callback.unregister_callback()