340175d607bbc082cce00539b21c2de37399afa2
[khatus.git] / bin / khatus_sensor_weather
1 #! /bin/sh
2
3 set -e
4
5 weather_station_id="$1"
6
7 metar -d "$weather_station_id" 2>&1 \
8 | awk '
9 /METAR pattern not found in NOAA data/ {
10 failures++
11 }
12
13 /^Temperature/ {
14 celsius = $3;
15 fahrenheit = (celsius * (9 / 5)) + 32;
16 temperature = fahrenheit
17 }
18
19 END {
20 if (failures > 0) {
21 temperature = "--"
22 }
23 print temperature "°F"
24 }'
This page took 0.060553 seconds and 3 git commands to generate.