Added location to output for better troubleshooting

This commit is contained in:
bluesaxman 2020-07-21 10:17:29 -06:00
parent 824ca04b56
commit f98faab11f
4 changed files with 9 additions and 4 deletions

View File

@ -92,5 +92,7 @@ elsif ($type =~ /Sun/) {$type = "";}
elsif ($type =~ /Snow/) {$type = "";}
else {$type=$type."...";}
print $type."  ".$temp."  ".$wdir." ".$wind."mph\n\n";
my $loc = substr(($weather[4] or "?????"), 0, 5);
print $loc." - ".$type."  ".$temp."  ".$wdir." ".$wind."mph\n\n";
print $color."\n";

View File

@ -13,8 +13,9 @@ my $info = `curl -sm 5 https://www.weatherbug.com/api/observation?lat=$URL_lat&l
my $json = decode_json $info or die "Error";
my $loc = %{$json}{"Observation"}->{"Station"}->{"StationName"};
my $temp = %{$json}{"Observation"}->{"Temperature"};
my $windS = %{$json}{"Observation"}->{"WindSpeedAvg"};
my $windD = %{$json}{"Observation"}->{"WindDirectionAvg"};
print "Unknown:".$temp.":".$windS.":".$windD;
print "Unknown:".$temp.":".$windS.":".$windD.":".$loc;

View File

@ -10,9 +10,10 @@ my $info = `curl -sm 5 "https://forecast.weather.gov/MapClick.php?lat=$URL_lat&l
my $json = decode_json $info or die "Error";
my $loc = %{$json}{"location"}->{"areaDescription"};
my $temp = %{$json}{"currentobservation"}->{"Temp"};
my $windS = %{$json}{"currentobservation"}->{"Winds"};
my $windD = %{$json}{"currentobservation"}->{"Windd"};
my $desc = %{$json}{"currentobservation"}->{"Weather"};
print $desc.":".$temp.":".$windS.":".$windD;
print $desc.":".$temp.":".$windS.":".$windD.":".$loc;

View File

@ -7,9 +7,10 @@ my $info = `curl -sm 5 wttr.in/bluffdale?format=j1` or die "Error";
my $json = decode_json $info or die "Error";
my $loc = %{$json}{"nearest_area"}->[0]->{"areaName"}->{"value"};
my $temp = %{$json}{"current_condition"}->[0]->{"temp_F"};
my $windS = %{$json}{"current_condition"}->[0]->{"windspeedMiles"};
my $windD = %{$json}{"current_condition"}->[0]->{"winddirDegree"};
my $desc = %{$json}{"current_condition"}->[0]->{"weatherDesc"}->[0]->{"value"};
print $desc.":".$temp.":".$windS.":".$windD;
print $desc.":".$temp.":".$windS.":".$windD.":".$loc;