X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=temp3.sh;h=e171b3ace0d2798bd446d72bec44533e0c17616f;hb=558a884c73f336c667f6fa174bd747e79c08d1fd;hp=16ec8c9dc522edafa1c182d1dee1150a4b379216;hpb=a5908cb30d5fdef3320f80879fa5277fd37097a1;p=vaillant-thermostat diff --git a/temp3.sh b/temp3.sh index 16ec8c9..e171b3a 100755 --- a/temp3.sh +++ b/temp3.sh @@ -39,13 +39,27 @@ curl -G 'http://10.60.0.89:8086/query' --data-urlencode "db=telegraf" --data-url __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__ +} + 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 'vani-t-h' 0 165 influx_rtl 'kutija-t-h' 95 90 82 influx_rtl 'kupaona-t-h' 125 148 133 influx_rtl 'kuhinja-t-h' 239 83 @@ -53,6 +67,7 @@ influx_rtl 'soba-t-h' 59 cat /dev/shm/curl | parallel +echo "parallel over" >/dev/stderr GRAY=`echo $QUERY_STRING | grep -i gray | wc -l`