fix dashboard SOS bug
This commit is contained in:
parent
67f2093ff3
commit
6b49e069e8
@ -133,40 +133,40 @@ 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 type(sos_file['time']) == str:
|
||||||
|
loc_time = str(sos_file['time'])
|
||||||
|
if type(sos_file['time']) == int or type(sos_file['time']) == float:
|
||||||
|
loc_time = datetime.fromtimestamp(sos_file['time']).strftime(time_format)
|
||||||
if '@NOTICE' in sos_file['message'] and '@SOS' not in sos_file['message']:
|
if '@NOTICE' in sos_file['message'] and '@SOS' not in sos_file['message']:
|
||||||
notice_header = '<span style="background-color: #ffffff; color: #008000;">NOTICE:</span>'
|
notice_header = '<span style="background-color: #ffffff; color: #008000;">NOTICE:</span>'
|
||||||
else:
|
else:
|
||||||
if type(sos_file['time']) == str:
|
|
||||||
loc_time = str(sos_file['time'])
|
|
||||||
if type(sos_file['time']) == int or type(sos_file['time']) == float:
|
|
||||||
loc_time = datetime.fromtimestamp(sos_file['time']).strftime(time_format)
|
|
||||||
notice_header = '<span style="background-color: #ff0000; color: #ffffff;">EMERGENCY ACTIVATION</span>'
|
notice_header = '<span style="background-color: #ff0000; color: #ffffff;">EMERGENCY ACTIVATION</span>'
|
||||||
value = Markup("""
|
value = Markup("""
|
||||||
<h1 style="text-align: center;">""" + notice_header + """</h1>
|
<h1 style="text-align: center;">""" + notice_header + """</h1>
|
||||||
<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>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 78.3667px;"><span style="text-decoration: underline;"><strong>From:</strong></span></td>
|
<td style="width: 78.3667px;"><span style="text-decoration: underline;"><strong>From:</strong></span></td>
|
||||||
<td style="width: 345.633px; text-align: center;"><strong>""" + sos_file['call'] + """</strong> - """ + str(sos_file['dmr_id']) + """</td>
|
<td style="width: 345.633px; text-align: center;"><strong>""" + sos_file['call'] + """</strong> - """ + str(sos_file['dmr_id']) + """</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 78.3667px;"><span style="text-decoration: underline;"><strong>Message:</strong></span></td>
|
<td style="width: 78.3667px;"><span style="text-decoration: underline;"><strong>Message:</strong></span></td>
|
||||||
<td style="width: 345.633px; text-align: center;">""" + sos_file['message'] + """</td>
|
<td style="width: 345.633px; text-align: center;">""" + sos_file['message'] + """</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 78.3667px;"><span style="text-decoration: underline;"><strong>Time:</strong></span></td>
|
<td style="width: 78.3667px;"><span style="text-decoration: underline;"><strong>Time:</strong></span></td>
|
||||||
<td style="width: 345.633px; text-align: center;">""" + loc_time + """</td>
|
<td style="width: 345.633px; text-align: center;">""" + loc_time + """</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
<button onclick="window.open('view_map?track=""" + sos_file['call'] + """&reload=30','_blank' );" type="button" class="emergency_button"><h1>View Station on Map</h1></button>
|
<button onclick="window.open('view_map?track=""" + sos_file['call'] + """&reload=30','_blank' );" type="button" class="emergency_button"><h1>View Station on Map</h1></button>
|
||||||
<p style="text-align: center;"><a href="https://aprs.fi/""" + sos_file['call'] + """"><strong>View on aprs.fi</strong></a></p>
|
<p style="text-align: center;"><a href="https://aprs.fi/""" + sos_file['call'] + """"><strong>View on aprs.fi</strong></a></p>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
""")
|
""")
|
||||||
return value
|
return value
|
||||||
except:
|
except Exception as e:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def aprs_to_latlon(x):
|
def aprs_to_latlon(x):
|
||||||
|
Loading…
Reference in New Issue
Block a user