tasmota dht11 sensor, same graph colors, legend outside
[vaillant-thermostat] / temp3.gnuplot
1 if ( gray == 1 ) {
2 #       set terminal pngcairo mono size 600,800
3         set terminal pngcairo color size 600,800
4 } else {
5         set terminal pngcairo color size 1200,600
6 }
7
8 set xdata time
9 set timefmt "%s"
10
11 if (strlen(interval) > 2) {
12         set xtics format "%H"
13 } else {
14         set xtics format "%H:%M"
15 }
16
17 set pointsize 0.2
18
19 set output '/dev/shm/temp3.png'
20
21 unset border
22
23 #set key outside
24 #set key top left horizontal
25
26 set multiplot
27
28
29 if ( gray == 1 ) {
30         set size 1, 0.5
31         set origin 0.0, 0.5
32 } else {
33         set size 1.0, 0.5
34         set origin 0.0, 0.5
35 }
36
37 #if ( ! exists("t_mean")) {
38 if (1) {
39
40 t_mean=25
41 t_spread=30
42
43 h_mean = 50
44 h_spread = 50
45
46 print "using default mean and spread"
47 }
48
49 min_t = t_mean - ( t_spread / 2 )
50 max_t = t_mean + ( t_spread / 2 )
51
52 if ( ! exists("tz_secs") ) {
53         tz_secs=7200
54 }
55
56 set ytics nomirror
57 unset y2tics
58 set y2range [0:50]
59
60 set key horizontal outside top right
61
62 plot \
63  "/dev/shm/data.DHT22-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DHT22" lt rgb "#ff00ff" \
64 ,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($2) with dots title "ir" lt rgb "#884400" \
65 ,"/dev/shm/data.stol-dht11-t-h" using ($1+tz_secs):($2) with dots title "stol" lt rgb "#cc4400" \
66 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($2) with dots title "kuhinja" lt rgb "#ff8844" \
67 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($2) with dots title "kupaona" lt rgb "#00ff80" \
68 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($2) with dots title "soba" lt rgb "#ffcc00" \
69 ,"/dev/shm/data.vani-t-h" using ($1+tz_secs):($2) with dots title "sunce" lt rgb "#00cc00" \
70 ,"/dev/shm/data.kutija-t-h" using ($1+tz_secs):($2) with dots title "hlad" lt rgb "#0088cc" \
71 ,"/dev/shm/data.DS18B20-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DS18B20" lt rgb "#880088" \
72 ,"/dev/shm/data.boiler-d" using ($1+tz_secs):($2 > 0 ? 50 : 0) axes x1y2 with dots title "boiler" lt rgb "#aaaaaa"
73
74
75 if ( exists("lines") && lines == 1 ) {
76 plot \
77  "/dev/shm/data.DHT22-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with lines title "DHT22" lt rgb "#ff00ff" \
78 ,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($2) with lines title "ir" lt rgb "#884400" \
79 ,"/dev/shm/data.stol-dht11-t-h" using ($1+tz_secs):($2) with lines title "stol" lt rgb "#cc4400" \
80 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($2) with lines title "kuhinja" lt rgb "#ff8844" \
81 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($2) with lines title "kupaona" lt rgb "#00ff80" \
82 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($2) with lines title "soba" lt rgb "#ffcc00" \
83 ,"/dev/shm/data.vani-t-h" using ($1+tz_secs):($2) with lines title "sunce" lt rgb "#00cc00" \
84 ,"/dev/shm/data.kutija-t-h" using ($1+tz_secs):($2) with lines title "hlad" lt rgb "#0088cc"  \
85 ,"/dev/shm/data.DS18B20-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with lines title "DS18B20" lt rgb "#880088" \
86 ,"/dev/shm/data.boiler-d" using ($1+tz_secs):($2 > 0 ? 50 : 0) axes x1y2 with dots title "boiler" lt rgb "#aaaaaa"
87 }
88
89 if ( gray == 1 ) {
90         set origin 0.0, 0.0
91 } else {
92         set origin 0.0, 0.0
93 }
94
95 set key off
96
97 min_h = h_mean - h_spread
98 max_h = h_mean + h_spread
99
100 plot \
101  "/dev/shm/data.DHT22-h" using ($1+tz_secs):($2 > min_h && $2 < max_h ? $2 : '') with dots title "DHT22" lt rgb "#ff00ff" \
102 ,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($3) with dots title "ir" lt rgb "#884400" \
103 ,"/dev/shm/data.stol-dht11-t-h" using ($1+tz_secs):($3) with dots title "stol" lt rgb "#cc4400" \
104 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($3) with dots title "kuhinja" lt rgb "#ff8844" \
105 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($3) with dots title "kupaona" lt rgb "#00ff80" \
106 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($3) with dots title "soba" lt rgb "#ffcc00" \
107 ,"/dev/shm/data.vani-t-h" using ($1+tz_secs):($3) with dots title "sunce" lt rgb "#00cc00" \
108 ,"/dev/shm/data.kutija-t-h" using ($1+tz_secs):($3) with dots title "hlad" lt rgb "#0088cc" \
109 ,"/dev/shm/data.boiler-d" using ($1+tz_secs):($2 > 0 ? 50 : 0) axes x1y2 with dots title "boiler" lt rgb "#aaaaaa"
110
111 if ( exists("lines") && lines == 1 ) {
112 plot \
113  "/dev/shm/data.DHT22-h" using ($1+tz_secs):($2 > min_h && $2 < max_h ? $2 : '') with lines title "DHT22" lt rgb "#ff00ff" \
114 ,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($3) with lines title "ir" lt rgb "#884400" \
115 ,"/dev/shm/data.stol-dht11-t-h" using ($1+tz_secs):($3) with lines title "stol" lt rgb "#cc4400" \
116 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($3) with lines title "kuhinja" lt rgb "#ff8844" \
117 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($3) with lines title "kupaona" lt rgb "#00ff80" \
118 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($3) with lines title "soba" lt rgb "#ffcc00" \
119 ,"/dev/shm/data.vani-t-h" using ($1+tz_secs):($3) with lines title "sunce" lt rgb "#00cc00" \
120 ,"/dev/shm/data.kutija-t-h" using ($1+tz_secs):($3) with lines title "hlad" lt rgb "#0088cc" \
121 ,"/dev/shm/data.boiler-d" using ($1+tz_secs):($2 > 0 ? 50 : 0) axes x1y2 with dots title "boiler" lt rgb "#aaaaaa"
122 }
123 unset multiplot