added more sensors, nicer graphs with same colors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 18 Aug 2017 21:58:43 +0000 (23:58 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 18 Aug 2017 21:58:43 +0000 (23:58 +0200)
temp2.gnuplot
temp2.sh

index 6c5b738..707904a 100644 (file)
@@ -20,7 +20,8 @@ set size 1, 0.5
 
 set origin 0.0, 0.5
 
-if ( ! exists("t_mean")) {
+#if ( ! exists("t_mean")) {
+if (1) {
 
 t_mean=25
 t_spread=25
@@ -37,9 +38,13 @@ max_t = t_mean + ( t_spread / 2 )
 set ytics nomirror
 set y2tics
 
-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" \
-,"/dev/shm/rtl_433-temperature" using ($1+7200):($2) with dots title "RTL433 deg. C"
+plot \
+ "/dev/shm/rtl_433-temperature" using ($1+7200):($2) with dots title "vani" \
+,"/dev/shm/DHT22-temperature" using ($1+7200):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DHT22 unutra" \
+,"/dev/shm/rtl_433-9-temperature" using ($1+7200):($3 == 1 ? $2 : '') with dots title "predsoblje" \
+,"/dev/shm/rtl_433-9-temperature" using ($1+7200):($3 == 2 ? $2 : '') with dots title "kupaona" \
+,"/dev/shm/rtl_433-9-temperature" using ($1+7200):($3 == 3 ? $2 : '') with dots title "kuhinja" \
+,"/dev/shm/DS18B20-temperature" using ($1+7200):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DS18B20 unutra"
 
 set origin 0.0, 0.0
 
@@ -47,7 +52,11 @@ set origin 0.0, 0.0
 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" \
-,"/dev/shm/rtl_433-humidity" using ($1+7200):($2 > 10 ? $2 : '') with dots title "RTL433 % hum" 
+plot \
+ "/dev/shm/rtl_433-humidity" using ($1+7200):($2 > 10 ? $2 : '') with lines title "vani" \
+,"/dev/shm/DHT22-humidity" using ($1+7200):($2 > min_h && $2 < max_h ? $2 : '') with dots title "DHT22 unutra" \
+,"/dev/shm/rtl_433-9-172-humidity" using ($1+7200):($2) with lines title "predsoblje" \
+,"/dev/shm/rtl_433-9-75-humidity" using ($1+7200):($2) with lines title "kupaona" \
+,"/dev/shm/rtl_433-9-141-humidity" using ($1+7200):($2) with lines title "kuhunja"
 
 unset multiplot
index c8b2390..e09d605 100755 (executable)
--- a/temp2.sh
+++ b/temp2.sh
@@ -12,11 +12,16 @@ curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-url
 curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"value\" FROM \"mqtt_consumer\" WHERE time > now() - 48h AND \"topic\"='stat/boiler/DHT22/humidity'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/DHT22-humidity
 
 curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"temperature_C\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"id\" = '5'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/rtl_433-temperature
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"temperature_C\",\"channel\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"id\" = '9'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' | tr -d '\\"' > /dev/shm/rtl_433-9-temperature
 
 curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT mean(\"value\"),spread(\"value\") FROM \"mqtt_consumer\" WHERE time > now() - 48h AND \"topic\"='stat/boiler/DS18B20/temperature'"  | jq '.results[0].series[0].values[0][1,2]' > /dev/shm/temperature.mean.spread
 curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT mean(\"value\"),spread(\"value\") FROM \"mqtt_consumer\" WHERE time > now() - 48h AND \"topic\"='stat/boiler/DHT22/humidity'"  | jq '.results[0].series[0].values[0][1,2]' > /dev/shm/humidity.mean.spread
 
 curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"humidity\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"id\" = '5'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/rtl_433-humidity
+#curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"humidity\",\"channel\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"id\" = '9'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' | tr -d '\\"' > /dev/shm/rtl_433-9-humidity
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"humidity\",\"channel\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"rid\" = '172'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' | tr -d '\\"' > /dev/shm/rtl_433-9-172-humidity
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"humidity\",\"channel\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"rid\" = '75'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' | tr -d '\\"' > /dev/shm/rtl_433-9-75-humidity
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"humidity\",\"channel\" FROM \"rtl_433\" WHERE time > now() - 48h AND \"topic\"='rpi2/rtl_433/influx' AND \"rid\" = '141'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' | tr -d '\\"' > /dev/shm/rtl_433-9-141-humidity
 
 
 cd /home/pi/vaillant-thermostat/