-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnoaa.py
70 lines (58 loc) · 2.06 KB
/
noaa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python
# Script created by Eric - KF7EEL
# This script will check for the specified alert types, then send
# SMS to the configured DMR ID or Talk group.
# Configure group of same codes to receive alerts for thos counties.
# Set this on a cron job to check regularly.
import re, binascii, shark, time
from weatheralerts import WeatherAlerts
# Configure SMS here.
# sms_type, 0 = private, 1 = group
# sms_format, 0 = ETSI, 1 = UDP, 2 = UDP/Chinese
# sms_dest, Talk group or DMR ID
# sms_modem, 0 = Network, send SMS to the network, 1 = Modem, send SMS to modem only,
# will not get sent to network
sms_type = "1"
sms_format = "2"
sms_dest = "9"
sms_modem = "1"
shark.do_checkauth()
# Same codes for Chelan, Douglas, Grant, and Okanogan Counties
nws = WeatherAlerts(samecodes=['053007','053017','053025','053047'])
# Same codes for entire state
#nws = WeatherAlerts(state='WA')
# Filter for Severe alerts
for alert in nws.alerts:
if "Severe" in alert.severity:
# 1=Type, Group | 2=Format, UDP/Chinese | 9=Talkgroup | alert.title= message
shark.do_send_sms(sms_type, sms_format, sms_dest, sms_modem, alert.title)
print(alert.title)
print(alert.severity)
print(alert.urgency)
print(alert.areadesc)
print(alert.samecodes)
print(alert.expiration)
print("\n")
time.sleep(1)
# Filter for Moderate alerts
if "Moderate" in alert.severity:
shark.do_send_sms(sms_type, sms_format, sms_dest, sms_modem, alert.title)
print (alert.title)
print (alert.severity)
print(alert.urgency)
print(alert.areadesc)
print(alert.samecodes)
print(alert.expiration)
print("\n")
time.sleep(1)
# Filter for Extreme alerts
if "Extreme" in alert.severity:
shark.do_send_sms(sms_type, sms_format, sms_dest, sms_modem, alert.title)
print (alert.title)
print (alert.severity)
print(alert.urgency)
print(alert.areadesc)
print(alert.samecodes)
print(alert.expiration)
print("\n")
time.sleep(1)