diff --git a/cambridge.sh b/cambridge.sh index 935e34a..b7e5e74 100755 --- a/cambridge.sh +++ b/cambridge.sh @@ -14,7 +14,7 @@ mymqtt_init "${ID}" "${TEM_ID}" "${S_TEMP}" "CBG TEMPERATURE" mymqtt_init "${ID}" "${HUM_ID}" "${S_HUM}" "CBG HUMIDITY" mymqtt_init "${ID}" "${BAR_ID}" "${S_BARO}" "CBG BAROMETER" mymqtt_init "${ID}" "${RAIN_ID}" "${S_RAIN}" "CBG RAIN" -#mymqtt_init "${ID}" "${SUN_ID}" "${S_CUSTOM}" "CBG SUN" +mymqtt_init "${ID}" "${SUN_ID}" "${S_CUSTOM}" "CBG SUN" while true; do cbg="$(wget -O- -q https://www.cl.cam.ac.uk/research/dtg/weather/current-obs.txt)" @@ -38,7 +38,7 @@ while true; do data[humidity]=$(echo "scale=0;$(grep "Humidity" <<< "${cbg}" | awk '{print $2}')/1" | bc) data[pressure]=$(echo "scale=2;$(grep "Pressure" <<< "${cbg}" | awk '{print $2}')/1" | bc) data[rain]=$(echo "scale=2;$(grep "Rainfall" <<< "${cbg}" | awk '{print $2}')/1" | bc) - data[sunshine]=$(echo "scale=2;$(grep "Rainfall" <<< "${cbg}" | awk '{print $2}')/1" | bc) + data[sunshine]=$(echo "scale=2;$(grep "Sunshine" <<< "${cbg}" | awk '{print $2}')/1" | bc) for key in "${!data[@]}"; do echo "PUTVAL $HOSTNAME/${prefix}/${key}${suffix} interval=$INTERVAL N:${data[$key]}" @@ -48,7 +48,7 @@ while true; do mymqtt_update "${ID}" "${HUM_ID}" "${V_HUM}" "${data[humidity]}" mymqtt_update "${ID}" "${BAR_ID}" "${V_PRESSURE}" "${data[pressure]}" mymqtt_update "${ID}" "${RAIN_ID}" "${V_RAIN}" "${data[rain]}" - #mymqtt_update "${ID}" "${SUN_ID}" "${V_VAR1}" "${data[sunshine]}" + mymqtt_update "${ID}" "${SUN_ID}" "${V_VAR1}" "${data[sunshine]}" sleep "$INTERVAL" done