add notice function as an alternative to emergency

This commit is contained in:
KF7EEL 2021-02-28 17:01:32 -08:00
parent ce36850621
commit 7febe66a76
3 changed files with 8 additions and 4 deletions

View File

@ -280,7 +280,7 @@ def process_sms(_rf_src, sms):
logger.info('Failed to send email.')
logger.info(error_exception)
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)
elif '@REM SOS' == sms:
os.remove('/tmp/gps_data_user_sos.txt')

View File

@ -272,11 +272,11 @@ def process_sms(_rf_src, sms):
logger.info('Failed to send email.')
logger.info(error_exception)
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)
elif '@REM SOS' == sms:
os.remove('/tmp/gps_data_user_sos.txt')
logger.info('Removing SOS')
logger.info('Removing SOS or Notice')
elif '@MH' in sms:
grid_square = re.sub('@MH ', '', sms)
if len(grid_square) < 6:

View File

@ -119,8 +119,12 @@ def check_emergency():
# open emergency txt
try:
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("""
<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>&nbsp;</p>
<table style="width: 441px; margin-left: auto; margin-right: auto;" border="3">
<tbody>