Skip to content

Commit

Permalink
Bugfix livegraph Hauptseite lädt zu lange
Browse files Browse the repository at this point in the history
  • Loading branch information
snaptec committed Jan 10, 2020
1 parent 86bc435 commit 676ca94
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
22 changes: 15 additions & 7 deletions graphing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,21 @@ fi
mosquitto_pub -t openWB/graph/alllivevalues -r -m "$(cat /var/www/html/openWB/ramdisk/all-live.graph | tail -n 80)" &
mosquitto_pub -t openWB/graph/lastlivevalues -r -m "$(date +%H:%M:%S),$wattbezugint,$ladeleistung,$pvgraph,$ladeleistunglp1,$ladeleistunglp2,$ladeleistung,$speicherleistung,$speichersoc,$soc,$soc1,$hausverbrauch,$verbraucher1_watt,$verbraucher2_watt,$ladeleistunglp3,$ladeleistunglp4,$ladeleistunglp5,$ladeleistunglp6,$ladeleistunglp7,$ladeleistunglp8" &
mosquitto_pub -t openWB/graph/1alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"0" | head -n "$((100 - 0))")" &
mosquitto_pub -t openWB/graph/2alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"100" | head -n "$((200 - 100))")" &
mosquitto_pub -t openWB/graph/3alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"200" | head -n "$((300 - 200))")" &
mosquitto_pub -t openWB/graph/4alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"300" | head -n "$((400 - 300))")" &
mosquitto_pub -t openWB/graph/5alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"400" | head -n "$((500 - 400))")" &
mosquitto_pub -t openWB/graph/6alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"500" | head -n "$((600 - 500))")" &
mosquitto_pub -t openWB/graph/7alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"600" | head -n "$((700 - 600))")" &
mosquitto_pub -t openWB/graph/8alllivevalues -r -m "$(< ramdisk/all-live.graph tail -n +"700" | head -n "$((800 - 700))")" &
all2livevalues=$(< ramdisk/all-live.graph tail -n +"100" | head -n "$((200 - 100))")
all3livevalues="$(< ramdisk/all-live.graph tail -n +"200" | head -n "$((300 - 200))")"
all4livevalues="$(< ramdisk/all-live.graph tail -n +"300" | head -n "$((400 - 300))")"
all5livevalues="$(< ramdisk/all-live.graph tail -n +"400" | head -n "$((500 - 400))")"
all6livevalues="$(< ramdisk/all-live.graph tail -n +"500" | head -n "$((600 - 500))")"
all7livevalues="$(< ramdisk/all-live.graph tail -n +"600" | head -n "$((700 - 600))")"
all8livevalues="$(< ramdisk/all-live.graph tail -n +"700" | head -n "$((800 - 700))")"

mosquitto_pub -t openWB/graph/2alllivevalues -r -m $([ ${#all2livevalues} -ge 10 ] && echo "$all2livevalues" || echo "-") &
mosquitto_pub -t openWB/graph/3alllivevalues -r -m $([ ${#all3livevalues} -ge 10 ] && echo "$all3livevalues" || echo "-") &
mosquitto_pub -t openWB/graph/4alllivevalues -r -m $([ ${#all4livevalues} -ge 10 ] && echo "$all4livevalues" || echo "-") &
mosquitto_pub -t openWB/graph/5alllivevalues -r -m $([ ${#all5livevalues} -ge 10 ] && echo "$all5livevalues" || echo "-") &
mosquitto_pub -t openWB/graph/6alllivevalues -r -m $([ ${#all6livevalues} -ge 10 ] && echo "$all6livevalues" || echo "-") &
mosquitto_pub -t openWB/graph/7alllivevalues -r -m $([ ${#all7livevalues} -ge 10 ] && echo "$all7livevalues" || echo "-") &
mosquitto_pub -t openWB/graph/8alllivevalues -r -m $([ ${#all8livevalues} -ge 10 ] && echo "$all8livevalues" || echo "-") &



Expand Down
1 change: 1 addition & 0 deletions web/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ function putgraphtogether() {
if ( (all1 == 1) && (all2 == 1) && (all3 == 1) && (all4 == 1) && (all5 == 1) && (all6 == 1) && (all7 == 1) && (all8 == 1) ){
var alldata = all1p + "\n" + all2p + "\n" + all3p + "\n" + all4p + "\n" + all5p + "\n" + all6p + "\n" + all7p + "\n" + all8p;
alldata = alldata.replace(/^\s*[\n]/gm, '');
alldata = alldata.replace(/^\s*-[\n]/gm, '');
var csvData = new Array();
var rawcsv = alldata.split(/\r?\n|\r/);
for (var i = 0; i < rawcsv.length; i++) {
Expand Down

0 comments on commit 676ca94

Please sign in to comment.