From 11340dc06d15e14c07aa82ddf501da94ff920fb3 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 13 Aug 2019 19:31:22 +0200 Subject: [PATCH] correctly select ids just for model --- temp3.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/temp3.sh b/temp3.sh index e171b3a..3a03422 100755 --- a/temp3.sh +++ b/temp3.sh @@ -31,11 +31,11 @@ __SHELL__ influx_rtl() { file=$1 shift; - rids=`echo $* | sed -e 's/\([0-9][0-9]*\)/ or id = '"'"'\1'"'"'/g' -e 's/^ or/ AND /'` + rids=`echo $* | sed -e 's/\([0-9][0-9]*\)/ or id = '"'"'\1'"'"'/g' -e 's/^ or//'` # 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 \"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 +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' AND ( $rids )" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/data.$file __SHELL__ } -- 2.20.1