don't log so much
[vaillant-thermostat] / temp2.gnuplot
index 9a3ccea..028c94e 100644 (file)
@@ -3,6 +3,8 @@ set terminal pngcairo mono size 600,800
 set xdata time
 set timefmt "%s"
 
+set xtics format "%H"
+
 set pointsize 0.2
 
 set output '/dev/shm/temp2.png'
@@ -12,10 +14,28 @@ set size 1, 0.5
 
 set origin 0.0, 0.5
 
-plot "/dev/shm/DS18B20-temperature" using 1:2 with dots title "DS18B20 deg. C","/dev/shm/DHT22-temperature" using 1:($2 > 1 && $2 < 45 ? $2 : '') with dots title "DHT22 deg. C"
+if ( ! exists("t_mean")) {
+
+t_mean=26
+t_spread=5
+
+h_mean = 50
+h_spread = 30
+
+print "using default mean and spread"
+}
+
+min_t = t_mean - t_spread
+max_t = t_mean + t_spread
+
+plot "/dev/shm/DS18B20-temperature" using ($1+7200):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DS18B20 deg. C","/dev/shm/DHT22-temperature" using ($1+7200):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DHT22 deg. C"
 
 set origin 0.0, 0.0
 
-plot "/dev/shm/DHT22-humidity" using 1:($2 > 3 ? $2 : '') with dots title "DHT22 % hum"
+
+min_h = h_mean - h_spread
+max_h = h_mean + h_spread
+
+plot "/dev/shm/DHT22-humidity" using ($1+7200):($2 > min_h && $2 < max_h ? $2 : '') with dots title "DHT22 % hum"
 
 unset multiplot