# 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__
}
influx_mqtt 'stat/boiler/d' 'boiler-d'
-influx_rtl 'vani-t-h' 108 40
-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' 95
+influx_rtl 'vani-t-h' 40 0
+influx_rtl 'kutija-t-h' 95 90 82
+influx_rtl 'kupaona-t-h' 125 148 133
+influx_rtl 'kuhinja-t-h' 239 83
+influx_rtl 'soba-t-h' 59
cat /dev/shm/curl | parallel