show temperatures without sending data to influx
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 26 Aug 2020 10:19:21 +0000 (12:19 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 26 Aug 2020 10:19:21 +0000 (12:19 +0200)
w1-ds18b20.sh [new file with mode: 0755]

diff --git a/w1-ds18b20.sh b/w1-ds18b20.sh
new file mode 100755 (executable)
index 0000000..9ef9e62
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+ls /sys/bus/w1/devices/w1_bus_master*/*-*/w1_slave | while read path ; do
+       temp=$( cat $path | grep t= | cut -d= -f2  | awk '{ printf "%.3f\n", $1 / 1000 }' )
+       if [ $temp != 85 ] ; then # 85 is error
+               id=$( echo $path | cut -d/ -f 7 )
+               echo -n "$id "
+               echo $temp | tee /dev/shm/ds18b20.$id
+       fi
+done