-
Notifications
You must be signed in to change notification settings - Fork 0
/
weatherbug.pl
28 lines (22 loc) · 949 Bytes
/
weatherbug.pl
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
#!/usr/bin/env perl
delete @ENV{qw(PATH)};
$ENV{PATH} = '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin';
$output = `bash -c 'wget --quiet -O - \"http:\/\/wisapidata.weatherbug.com\/WxDataISAPI\/WxDataISAPI.dll?Magic=10991&RegNum=3647055&ZipCode=17241&StationID=NWVLL&Units=0&Version=2.7&Fore=1&t=1015084854\/"'`;
$output =~ s/[^-0-9|\|.]*//gi;
@weather = split(/\|/, $output);
# docs
# [0] - ID?
# [1] - Current Time
# [2] - Current Date
# [3] - Current Temperature
# [5] - Wind Speed (MPH)
# [7] - Gust Wind Speed (MPH)
# [10] - Barometer (Moisture)
# [11] - Humidity (%)
# [12] - High Temperature
# [13] - Low Temperature
# [14] - Dew Point
# [15] - Wind Chill
print "current_temp:" . $weather[3] . " wind_speed:" . $weather[5] . " barometer:" . $weather[10] . " humidity:" .
$weather[11] . " high_temp:" . $weather[12] . " low_temp:" . $weather[13] . " dew_point_temp:" .
$weather[14] . " wind_chill_temp:" . $weather[15];