X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=temp3.sh;h=d96afead0da1ef7fdb9a070a32a11134187096a2;hb=129a1d9fe24fa168ea672f0cb4242ab9c39cdd41;hp=e58ce0d243a7d2502dfd0feedb3418512b6f23a7;hpb=45d918e33740dcba7f712822bf7e1c89722558bb;p=vaillant-thermostat diff --git a/temp3.sh b/temp3.sh index e58ce0d..d96afea 100755 --- 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"