draw rtl 433mhz data on y2 axis with separate scale
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 4 Aug 2017 09:18:35 +0000 (11:18 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 4 Aug 2017 09:18:35 +0000 (11:18 +0200)
temp2.gnuplot
temp2.sh

index 304d54e..42c988d 100644 (file)
@@ -1,4 +1,4 @@
-set terminal pngcairo mono size 600,800
+set terminal pngcairo color size 600,800
 
 set xdata time
 set timefmt "%s"
 
 set xdata time
 set timefmt "%s"
@@ -16,8 +16,8 @@ set origin 0.0, 0.5
 
 if ( ! exists("t_mean")) {
 
 
 if ( ! exists("t_mean")) {
 
-t_mean=26
-t_spread=5
+t_mean=25
+t_spread=25
 
 h_mean = 50
 h_spread = 30
 
 h_mean = 50
 h_spread = 30
@@ -28,9 +28,12 @@ print "using default mean and spread"
 min_t = t_mean - t_spread
 max_t = t_mean + t_spread
 
 min_t = t_mean - t_spread
 max_t = t_mean + t_spread
 
+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" \
 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 > min_t && $2 < max_t ? $2 : '') with dots title "RTL 433 deg. C"
+,"/dev/shm/rtl_433-temperature" using ($1+7200):($2) with dots title "RTL433 deg. C" axes x1y2
 
 set origin 0.0, 0.0
 
 
 set origin 0.0, 0.0
 
@@ -38,6 +41,7 @@ set origin 0.0, 0.0
 min_h = h_mean - h_spread
 max_h = h_mean + h_spread
 
 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"
+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) with dots title "RTL433 % hum" axis x1y2
 
 unset multiplot
 
 unset multiplot
index 6a35042..b14ddf0 100755 (executable)
--- a/temp2.sh
+++ b/temp2.sh
@@ -16,6 +16,7 @@ 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 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 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
 
 cd /home/pi/vaillant-thermostat/
 gnuplot -e "t_mean=`head -1 /dev/shm/temperature.mean.spread`;t_spread=`tail -1 /dev/shm/temperature.mean.spread`;h_mean=`head -1 /dev/shm/humidity.mean.spread` ; h_spread=`tail -1 /dev/shm/humidity.mean.spread`" temp2.gnuplot
 
 cd /home/pi/vaillant-thermostat/
 gnuplot -e "t_mean=`head -1 /dev/shm/temperature.mean.spread`;t_spread=`tail -1 /dev/shm/temperature.mean.spread`;h_mean=`head -1 /dev/shm/humidity.mean.spread` ; h_spread=`tail -1 /dev/shm/humidity.mean.spread`" temp2.gnuplot