add send_sms file (for testing)

This commit is contained in:
Pavel Valach 2021-02-02 11:32:13 +01:00
parent cae36c789c
commit 2ddf0a626f
No known key found for this signature in database
GPG Key ID: 5B4C9E8526682172

25
send_sms.py Normal file
View File

@ -0,0 +1,25 @@
#!/usr/bin/python3
import logging
import os
import sys
from pydbus import SystemBus
from gi.repository import GLib
import sms_functions
# Setup logging
logfile = "/opt/sms/sms.log"
FORMAT = '%(asctime)-15s %(message)s'
logging.basicConfig(format=FORMAT,filename=logfile,level=10)
logger = logging.getLogger('observiumsms')
if len(sys.argv) < 3:
raise Exception('Not enough arguments')
# Assemble SMS
smsstring = sys.argv[1]
nums = sys.argv[2:]
logger.info("Sending SMS: %s", smsstring)
# Contact ModemManager, unlock SIM and send SMS to emergency numbers
sms_functions.send_sms(nums, smsstring)