moving cambridge sensor to curl_json to align with domoticz collectors

This commit is contained in:
Peter Molnar 2018-12-03 10:22:41 +00:00
parent c9b854a123
commit 6fbe1418c2

View file

@ -31,17 +31,20 @@ while true; do
#Summary: very humid, cold, light winds #Summary: very humid, cold, light winds
prefix="sensors-weather" #prefix="sensors-weather"
suffix="-cambridge" plugin="curl_json"
instance="sensors"
key_instance="cambridge"
declare -A data declare -A data
data[temperature]=$(grep "Temperature" <<< "${cbg}" | awk '{print $2}') data[temperature]=$(grep "Temperature" <<< "${cbg}" | awk '{print $2}')
data[humidity]=$(echo "scale=0;$(grep "Humidity" <<< "${cbg}" | awk '{print $2}')/1" | bc) 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[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[rain]=$(echo "scale=2;$(grep "Rainfall" <<< "${cbg}" | awk '{print $2}')/1" | bc)
data[sunshine]=$(echo "scale=2;$(grep "Sunshine" <<< "${cbg}" | awk '{print $2}')/1" | bc) data[sunshine]=$(echo "scale=2;$(grep "Sunshine" <<< "${cbg}" | awk '{print $2}')/1" | bc)
data[dewpoint]=$(grep "Dewpoint" <<< "${cbg}" | awk '{print $2}')
for key in "${!data[@]}"; do for key in "${!data[@]}"; do
echo "PUTVAL $HOSTNAME/${prefix}/${key}${suffix} interval=$INTERVAL N:${data[$key]}" echo "PUTVAL $HOSTNAME/${plugin}-${instance}/${key}-${key_instance} interval=$INTERVAL N:${data[$key]}"
done done
mymqtt_update "${ID}" "${TEM_ID}" "${V_TEMP}" "${data[temperature]}" mymqtt_update "${ID}" "${TEM_ID}" "${V_TEMP}" "${data[temperature]}"