X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=temp3.sh;h=1498c8b6f3ba30dc10b27acde27d343f71f1cc4d;hb=3d3b89419d1779891fd4cd4701ceeafff6a22c44;hp=cb0266892508fb6c9d2d45df69c38f5e50eb1630;hpb=cd8a2ddb9762ee2d0de4db0f0a3e650c5cd05546;p=vaillant-thermostat diff --git a/temp3.sh b/temp3.sh index cb02668..1498c8b 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__ } @@ -67,12 +67,12 @@ rename_ids() { 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' 181 183 -rename_ids 'soba-t-h' 4 80 -rename_ids 'hodnik-t-h' 167 99 +rename_ids 'vani-t-h' 238 126 # sunce +rename_ids 'kutija-t-h' 162 237 # hlad +rename_ids 'kupaona-t-h' 247 78 +rename_ids 'kuhinja-t-h' 44 154 +rename_ids 'soba-t-h' 115 235 +rename_ids 'hodnik-t-h' 99 145 influx_mqtt 'stat/boiler/DS18B20/temperature' 'DS18B20-t'