X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=temp3.sh;h=59f70e0e51b716b3b4b799220b950f6c38073d33;hb=fc57852d8f97265ad9374ca14dcd6e1290d888a7;hp=97eab23d7a2ff7e13416e57409cfffd6d1f2dc8e;hpb=6d6511812b9e844e6817809c6b169e112ff1ba3b;p=vaillant-thermostat diff --git a/temp3.sh b/temp3.sh index 97eab23..59f70e0 100755 --- a/temp3.sh +++ b/temp3.sh @@ -24,7 +24,7 @@ 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_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 +curl -G 'http://10.60.0.92: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__ } @@ -35,7 +35,7 @@ influx_rtl() { # 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' AND ( $rids )" | sed -e 's/^.*"values":\[\[//' -e 's/\],\[/\n/g' -e 's/,/ /g' -e 's/]].*$//' > /dev/shm/data.$file +curl -G 'http://10.60.0.92: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__ } @@ -46,7 +46,7 @@ influx_tele() { 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 +curl -G 'http://10.60.0.92: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__ } @@ -56,23 +56,24 @@ curl -G 'http://10.60.0.92:8086/query' --data-urlencode "db=rtl_433" --data-urle rename_ids() { to=$1 - rm /dev/shm/data.$to shift while [ ! -z "$1" ] ; do if [ -e /dev/shm/id.$1 ] ; then cat /dev/shm/id.$1 > /dev/shm/data.$to rm /dev/shm/id.$1 + else + rm /dev/shm/data.$to fi shift done } -rename_ids 'vani-t-h' 84 211 # sunce -rename_ids 'kutija-t-h' 241 249 # hlad -rename_ids 'kupaona-t-h' 98 82 -rename_ids 'kuhinja-t-h' 183 111 -rename_ids 'soba-t-h' 4 80 -rename_ids 'hodnik-t-h' 167 99 +rename_ids 'vani-t-h' 1 154 # sunce +rename_ids 'kutija-t-h' 237 114 # hlad +rename_ids 'kupaona-t-h' 15 92 +rename_ids 'kuhinja-t-h' 33 126 +rename_ids 'soba-t-h' 105 234 +rename_ids 'hodnik-t-h' 145 181 influx_mqtt 'stat/boiler/DS18B20/temperature' 'DS18B20-t'