vani battery change
[vaillant-thermostat] / temp3.sh
index e58ce0d..d96afea 100755 (executable)
--- a/temp3.sh
+++ b/temp3.sh
@@ -24,18 +24,18 @@ influx_mqtt() {
 
 #      echo "# $topic [$rids] -> $file"
        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 \"value\" FROM \"mqtt_consumer\" WHERE time > now() - $INTERVAL AND \"topic\"='$topic' $rids" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/data.$file
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"value\" FROM \"mqtt_stat\" 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_rtl() {
        file=$1
        shift;
-       rids=`echo $* | sed -e 's/\([0-9][0-9]*\)/ or "rid" = '"'"'\1'"'"'/g' -e 's/^ or/ AND /'`
+       rids=`echo $* | sed -e 's/\([0-9][0-9]*\)/ or "id" = '"'"'\1'"'"'/g' -e 's/^ or/ AND /'`
 
 #      echo "# $topic [$rids] -> $file"
        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 \"temperature_C\",\"humidity\" FROM \"rtl_433\" WHERE time > now() - $INTERVAL $rids" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/data.$file
+curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"temperature_C\",\"humidity\" FROM \"mqtt_rtl_433\" WHERE time > now() - $INTERVAL and model="Prologue-TH" $rids" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/data.$file
 __SHELL__
 }
 
@@ -45,11 +45,11 @@ influx_mqtt 'stat/boiler/DHT22/humidity'            'DHT22-h'
 
 influx_mqtt    'stat/boiler/d'                         'boiler-d'
 
-influx_rtl     'vani-t-h' 108 40
-influx_rtl     'kutija-t-h' 55
+influx_rtl     'vani-t-h' 40 0
+influx_rtl     'kutija-t-h' 59
 influx_rtl     'kupaona-t-h' 125 148
 influx_rtl     'kuhinja-t-h' 175 239
-influx_rtl     'soba-t-h' 125 184
+influx_rtl     'soba-t-h' 95
 
 cat /dev/shm/curl | parallel
 
@@ -68,7 +68,7 @@ else
        GRAY=""
 fi
 
-#set > /dev/shm/temp3.cgi.vars
+set > /dev/shm/temp3.cgi.vars
 
 lines_checked=""
 test "$LINES" = 1 && lines_checked="checked"