X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=temp3.sh;h=f587c46d45a83563b3b17c1a9f19924bd359eb80;hb=4688a6ff0b7959ff1187feb46d551fd41429948a;hp=319af0a5b85dfe992ff112bc39f3264fe1f44ba2;hpb=7201960c2841da02e3b0d165af0197dd57af3b71;p=vaillant-thermostat diff --git a/temp3.sh b/temp3.sh index 319af0a..f587c46 100755 --- a/temp3.sh +++ b/temp3.sh @@ -31,11 +31,22 @@ __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__ +} + +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__ } @@ -43,16 +54,20 @@ 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_tele 'tele/dht11-ir-hdmi/SENSOR' 'DHT11_Temperature' 'DHT11_Humidity' 'stol-dht11-t-h' + influx_mqtt 'stat/boiler/d' 'boiler-d' -influx_rtl 'vani-t-h' 40 0 -influx_rtl 'kutija-t-h' 95 90 -influx_rtl 'kupaona-t-h' 125 148 -influx_rtl 'kuhinja-t-h' 175 239 -influx_rtl 'soba-t-h' 59 +influx_rtl 'vani-t-h' 0 165 +influx_rtl 'kutija-t-h' 82 104 228 +influx_rtl 'kupaona-t-h' 122 114 +influx_rtl 'kuhinja-t-h' 199 27 +influx_rtl 'soba-t-h' 59 252 cat /dev/shm/curl | parallel +echo "parallel over" >/dev/stderr GRAY=`echo $QUERY_STRING | grep -i gray | wc -l`