From: Dobrica Pavlinusic Date: Wed, 26 Aug 2020 12:28:19 +0000 (+0200) Subject: added sensor name X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=881f4d184f7488f61731f8ccc951a077cf67f0fd;p=rpi-ds18b20 added sensor name --- diff --git a/w1-ds18b20-influx.sh b/w1-ds18b20-influx.sh index 9908150..a3ba047 100755 --- a/w1-ds18b20-influx.sh +++ b/w1-ds18b20-influx.sh @@ -10,8 +10,10 @@ ls /sys/bus/w1/devices/w1_bus_master*/*-*/w1_slave | while read path ; do if [ $temp -ne 85000 ] ; then # 85 is error temp=$( echo $temp | awk '{ printf "%.3f\n", $1 / 1000 }' ) id=$( echo $path | cut -d/ -f 7 ) - echo "ac_temp,dc=a125,sensor=$id temperature=$temp" >> $influx + name=$( grep "^$id" id2name.txt | cut -d' ' -f2 ) + echo "ac_temp,dc=a125,sensor=$id,name=$name temperature=$temp" >> $influx echo $temp > /dev/shm/ds18b20.$id + echo $temp > /dev/shm/ds18b20.name.$name fi done