add notice function as an alternative to emergency
This commit is contained in:
parent
ce36850621
commit
7febe66a76
@ -280,7 +280,7 @@ def process_sms(_rf_src, sms):
|
|||||||
logger.info('Failed to send email.')
|
logger.info('Failed to send email.')
|
||||||
logger.info(error_exception)
|
logger.info(error_exception)
|
||||||
logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
||||||
elif '@SOS' in sms:
|
elif '@SOS' in sms or '@NOTICE' in sms:
|
||||||
sos_write(int_id(_rf_src), time.strftime('%H:%M:%S - %m/%d/%y'), sms)
|
sos_write(int_id(_rf_src), time.strftime('%H:%M:%S - %m/%d/%y'), sms)
|
||||||
elif '@REM SOS' == sms:
|
elif '@REM SOS' == sms:
|
||||||
os.remove('/tmp/gps_data_user_sos.txt')
|
os.remove('/tmp/gps_data_user_sos.txt')
|
||||||
|
@ -272,11 +272,11 @@ def process_sms(_rf_src, sms):
|
|||||||
logger.info('Failed to send email.')
|
logger.info('Failed to send email.')
|
||||||
logger.info(error_exception)
|
logger.info(error_exception)
|
||||||
logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
||||||
elif '@SOS' in sms:
|
elif '@SOS' in sms or '@NOTICE' in sms:
|
||||||
sos_write(int_id(_rf_src), time.strftime('%H:%M:%S - %m/%d/%y'), sms)
|
sos_write(int_id(_rf_src), time.strftime('%H:%M:%S - %m/%d/%y'), sms)
|
||||||
elif '@REM SOS' == sms:
|
elif '@REM SOS' == sms:
|
||||||
os.remove('/tmp/gps_data_user_sos.txt')
|
os.remove('/tmp/gps_data_user_sos.txt')
|
||||||
logger.info('Removing SOS')
|
logger.info('Removing SOS or Notice')
|
||||||
elif '@MH' in sms:
|
elif '@MH' in sms:
|
||||||
grid_square = re.sub('@MH ', '', sms)
|
grid_square = re.sub('@MH ', '', sms)
|
||||||
if len(grid_square) < 6:
|
if len(grid_square) < 6:
|
||||||
|
@ -119,8 +119,12 @@ def check_emergency():
|
|||||||
# open emergency txt
|
# open emergency txt
|
||||||
try:
|
try:
|
||||||
sos_file = ast.literal_eval(os.popen('cat /tmp/gps_data_user_sos.txt').read())
|
sos_file = ast.literal_eval(os.popen('cat /tmp/gps_data_user_sos.txt').read())
|
||||||
|
if '@NOTICE' in sos_file['message'] and '@SOS' not in sos_file['message']:
|
||||||
|
notice_header = '<span style="background-color: #ffffff; color: #008000;">NOTICE:</span>'
|
||||||
|
else:
|
||||||
|
notice_header = '<span style="background-color: #ff0000; color: #ffffff;">EMERGENCY ACTIVATION</span>'
|
||||||
value = Markup("""
|
value = Markup("""
|
||||||
<h1 style="text-align: center;"><span style="background-color: #ff0000; color: #ffffff;">EMERGENCY ACTIVATION</span></h1>
|
<h1 style="text-align: center;">""" + notice_header + """</h1>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
<table style="width: 441px; margin-left: auto; margin-right: auto;" border="3">
|
<table style="width: 441px; margin-left: auto; margin-right: auto;" border="3">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
Loading…
Reference in New Issue
Block a user