draw tasmota tele graph for sensor
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 13 Aug 2019 09:32:33 +0000 (11:32 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 13 Aug 2019 09:32:33 +0000 (11:32 +0200)
temp3.gnuplot
temp3.sh

index 2a11e1d..89e2609 100644 (file)
@@ -57,6 +57,7 @@ set y2range [0:50]
 plot \
  "/dev/shm/data.DHT22-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DHT22 unutra" lt rgb "#ff00ff" \
 ,"/dev/shm/data.DS18B20-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with dots title "DS18B20 unutra" lt rgb "#880088" \
+,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($2) with dots title "ir unutra" lt rgb "#884400" \
 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($2) with dots title "kuhinja" lt rgb "#ff8844" \
 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($2) with dots title "kupaona" lt rgb "#00ff80" \
 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($2) with dots title "soba" lt rgb "#ffcc00" \
@@ -69,6 +70,7 @@ if ( exists("lines") && lines == 1 ) {
 plot \
  "/dev/shm/data.DHT22-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with lines title "DHT22 unutra" lt rgb "#ff00ff" \
 ,"/dev/shm/data.DS18B20-t" using ($1+tz_secs):($2 > min_t && $2 < max_t ? $2 : '') with lines title "DS18B20 unutra" lt rgb "#880088" \
+,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($2) with lines title "ir unutra" lt rgb "#884400" \
 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($2) with lines title "kuhinja" lt rgb "#ff8844" \
 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($2) with lines title "kupaona" lt rgb "#00ff80" \
 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($2) with lines title "soba" lt rgb "#ffcc00" \
@@ -88,6 +90,7 @@ max_h = h_mean + h_spread
 
 plot \
  "/dev/shm/data.DHT22-h" using ($1+tz_secs):($2 > min_h && $2 < max_h ? $2 : '') with dots title "DHT22 unutra" lt rgb "#ff00ff" \
+,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($3) with dots title "ir unutra" lt rgb "#884400" \
 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($3) with dots title "kuhinja" lt rgb "#ff8844" \
 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($3) with dots title "kupaona" lt rgb "#00ff80" \
 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($3) with dots title "soba" lt rgb "#ffcc00" \
@@ -98,6 +101,7 @@ plot \
 if ( exists("lines") && lines == 1 ) {
 plot \
  "/dev/shm/data.DHT22-h" using ($1+tz_secs):($2 > min_h && $2 < max_h ? $2 : '') with lines title "DHT22 unutra" lt rgb "#ff00ff" \
+,"/dev/shm/data.ir-dht22-t-h" using ($1+tz_secs):($3) with lines title "ir unutra" lt rgb "#884400" \
 ,"/dev/shm/data.kuhinja-t-h" using ($1+tz_secs):($3) with lines title "kuhinja" lt rgb "#ff8844" \
 ,"/dev/shm/data.kupaona-t-h"  using ($1+tz_secs):($3) with lines title "kupaona" lt rgb "#00ff80" \
 ,"/dev/shm/data.soba-t-h" using ($1+tz_secs):($3) with lines title "soba" lt rgb "#ffcc00" \
index 92da878..abf9f32 100755 (executable)
--- a/temp3.sh
+++ b/temp3.sh
@@ -39,10 +39,23 @@ curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-url
 __SHELL__
 }
 
+influx_tele() {
+       topic=$1
+       t_col=$2
+       h_col=$3
+       file=$4
+
+       cat <<__SHELL__ >> /dev/shm/curl
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"$t_col\",\"$h_col\" FROM \"mqtt_tele_sensor\" WHERE time > now() - $INTERVAL and topic='$topic'" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/data.$file
+__SHELL__
+}
+
 influx_mqtt    'stat/boiler/DS18B20/temperature'       'DS18B20-t'
 influx_mqtt    'stat/boiler/DHT22/temperature'         'DHT22-t'
 influx_mqtt    'stat/boiler/DHT22/humidity'            'DHT22-h'
 
+influx_tele    'tele/ir/SENSOR' 'AM2301_Temperature' 'AM2301_Humidity' 'ir-dht22-t-h'
+
 influx_mqtt    'stat/boiler/d'                         'boiler-d'
 
 influx_rtl     'vani-t-h' 0 165