improve graphs and send them to kindle
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 20 Mar 2017 09:28:57 +0000 (10:28 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 20 Mar 2017 09:28:57 +0000 (10:28 +0100)
temp.gnuplot
temp.sh

index a8a2006..50a476b 100644 (file)
@@ -6,10 +6,10 @@ set timefmt "%s"
 set pointsize 0.2
 
 set output '/dev/shm/1.png'
-plot "/dev/shm/temp.tsv" using 1:2 with points title "DS18B20 deg. C"
+plot "/dev/shm/temp.tsv" using 1:2 with points title "DS18B20 deg. C","/dev/shm/temp.tsv" using 1:($3 > 1 && $3 < 45 ? $3 : '') with dots title "DHT22 deg. C"
 
 set output '/dev/shm/2.png'
-plot "/dev/shm/temp.tsv" using 1:($3 > 1 ? $3 : '') with dots title "DHT22 deg. C"
+plot "/dev/shm/temp.tsv" using 1:($3 > 1 && $3 < 45 ? $3 : '') with dots title "DHT22 deg. C"
 
 set output '/dev/shm/3.png'
 plot "/dev/shm/temp.tsv" using 1:($4 > 3 ? $4 : '') with dots title "DHT22 % hum"
diff --git a/temp.sh b/temp.sh
index ad5dcde..dc82bd8 100755 (executable)
--- a/temp.sh
+++ b/temp.sh
@@ -1,9 +1,14 @@
 #!/bin/sh -x
 
+kindle=192.168.3.100
+
 #ssh rpi 'cat `ls -t /dev/shm/vaillant.* | head -1` | sed "s/  .*| */ /"' > /dev/shm/temp.tsv
-cat `ls -t /dev/shm/vaillant.* | head -1` | sed "s/  .*| */ /" > /dev/shm/temp.tsv
+tail -8640 `ls -t /dev/shm/vaillant.* | head -1` | sed "s/  .*| */ /" > /dev/shm/temp.tsv
 gnuplot temp.gnuplot
 montage /dev/shm/[1-3].png -tile 1x3 -geometry +0+0 /tmp/m1.png
 convert /tmp/m1.png -gravity center -extent 600x800 /tmp/m1.pgm
 #display /tmp/m1.pgm
-./pgm2fb.pl /tmp/m1.pgm | ssh root@192.168.3.100 'dd of=/dev/fb0 ; echo 2 > /proc/eink_fb/update_display'
+
+if ping $kindle ; then
+       ./pgm2fb.pl /tmp/m1.pgm | ssh root@$kindle 'dd of=/dev/fb0 ; echo 2 > /proc/eink_fb/update_display'
+fi