Skip to content

Commit

Permalink
Merge pull request #174 from snaptec/master
Browse files Browse the repository at this point in the history
1.49c
  • Loading branch information
snaptec committed Jun 6, 2019
2 parents 592b9e3 + ff3c79b commit 0e27cbc
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 6 deletions.
13 changes: 13 additions & 0 deletions runs/atreboot.sh
Expand Up @@ -1213,6 +1213,18 @@ if ! grep -Fq "fsm63a3modbusllid=" /var/www/html/openWB/openwb.conf
then
echo "fsm63a3modbusllid=8" >> /var/www/html/openWB/openwb.conf
fi
if ! grep -Fq "wakeupzoelp1=" /var/www/html/openWB/openwb.conf
then
echo "wakeupzoelp1=0" >> /var/www/html/openWB/openwb.conf
fi
if ! grep -Fq "wakeupzoelp2=" /var/www/html/openWB/openwb.conf
then
echo "wakeupzoelp2=0" >> /var/www/html/openWB/openwb.conf
fi
if ! grep -Fq "plz=" /var/www/html/openWB/openwb.conf
then
echo "plz=36124" >> /var/www/html/openWB/openwb.conf
fi


ethstate=$(</sys/class/net/eth0/carrier)
Expand Down Expand Up @@ -1254,6 +1266,7 @@ then
fi

. /var/www/html/openWB/openwb.conf
/var/www/html/openWB/runs/gsiabfrage.sh &
sudo cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
uuid=$(</sys/class/net/eth0/address)
owbv=$(</var/www/html/openWB/web/version)
Expand Down
3 changes: 2 additions & 1 deletion runs/cronnightly.sh
@@ -1,7 +1,8 @@
#!/bin/bash

echo "Start cron nightly @ $(date)"

#gsi daten abfragen
/var/www/html/openWB/runs/gsiabfrage.sh &
#logfile aufräumen
echo "$(tail -1000 /var/log/openWB.log)" > /var/log/openWB.log

Expand Down
15 changes: 15 additions & 0 deletions runs/gsiabfrage.sh
@@ -0,0 +1,15 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf
data=$(curl -s https://api.corrently.io/core/gsi?plz=$plz)
rm /var/www/html/openWB/ramdisk/gsiforecast.csv

echo $data |jq -r '.forecast[] | "\(.epochtime) \(.gsi)"' | while read line
do
time=$(echo $line | awk '{print $1;}')
ftime=$(date -d@"$time" +%d"Day"-%H"H")
gsi=$(echo $line | awk '{print $2;}')

echo "$ftime,$gsi" >> /var/www/html/openWB/ramdisk/gsiforecast.csv
done

29 changes: 29 additions & 0 deletions web/gsigraph.js
@@ -0,0 +1,29 @@

am4core.useTheme(am4themes_animated);
// Create chart instance
var chart = am4core.create("gsidiv", am4charts.XYChart);
// Set up data source
chart.dataSource.url = "/openWB/ramdisk/gsiforecast.csv";
//}
chart.validateData();
chart.dataSource.parser = new am4core.CSVParser();
chart.dataSource.parser.options.useColumnNames = false;

// Create axes
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "col0";

// Create value axis
var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.title.text = "GSI";

var series1 = chart.series.push(new am4charts.LineSeries());
series1.dataFields.valueY = "col1";
series1.dataFields.categoryX = "col0";
series1.name = "gsi";
series1.fill = am4core.color("#ff0000");
series1.stroke = am4core.color("#ff0000");
series1.strokeWidth = 3;
series1.strokeWidth = 1.5;
series1.fillOpacity = 0.3;
// Add legend
7 changes: 7 additions & 0 deletions web/modulconfig.php
Expand Up @@ -465,6 +465,13 @@ function checkmodification(){
if(strpos($line, "zoelp2passwort=") !== false) {
list(, $zoelp2passwortold) = explode("=", $line);
}
if(strpos($line, "wakeupzoelp1=") !== false) {
list(, $wakeupzoelp1old) = explode("=", $line);
}
if(strpos($line, "wakeupzoelp2=") !== false) {
list(, $wakeupzoelp2old) = explode("=", $line);
}

if(strpos($line, "evnotifytoken=") !== false) {
list(, $evnotifytokenold) = explode("=", $line);
}
Expand Down
2 changes: 1 addition & 1 deletion web/setTheme.php
Expand Up @@ -40,7 +40,7 @@
<li><a data-toggle="tab" href="./index.php">Zurück</a></li>
<li><a href="./settings.php">Einstellungen</a></li>
<li><a href="./pvconfig.php">PV Ladeeinstellungen</a></li>
<li><a href="./modulconfig.php>">Modulkonfiguration</a></li>
<li><a href="./modulconfig.php">Modulkonfiguration</a></li>
<li class="active"><a href="./setTheme.php">Theme</a></li>
<li><a href="./misc.php">Misc</a></li>
</ul>
Expand Down
11 changes: 10 additions & 1 deletion web/settings.php
Expand Up @@ -48,7 +48,9 @@
if(strpos($line, "dspeed=") !== false) {
list(, $dspeedold) = explode("=", $line);
}

if(strpos($line, "plz=") !== false) {
list(, $plzold) = explode("=", $line);
}
if(strpos($line, "sdmids1=") !== false) {
list(, $sdmids1old) = explode("=", $line);
}
Expand Down Expand Up @@ -420,7 +422,14 @@
<div class="col-xs-1">
</div>
<div class="col-xs-10">
<div class="row ">

<b><label for="plz">Postleitzahl:</label></b>
<input type="text" name="plz" id="plz" value="<?php echo $plzold ?>"><br>
</div>
<div class="row">
Gültige Werte z.B. 36124 <br> Dient zur Ermittlung des GSI Index. Weitere Infos unter: <a href="https://www.corrently.de/hintergrund/gruenstromindex">Hier</a><br>Derzeit als optische Einbindung unter Status zu finden. Künftig Laden nach GSI möglich.<br><br>
</div><hr>
<div class="row">
<b><h5><label for="Zielladen">Zielladen Ladepunkt 1:(BETA)</label></b>
<select type="text" name="zielladenaktivlp1" id="zielladenaktivlp1">
Expand Down
11 changes: 9 additions & 2 deletions web/status.php
Expand Up @@ -3,6 +3,10 @@

<head>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/core.js"></script>
<script src="js/charts.js"></script>
<script src="js/animated.js"></script>

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down Expand Up @@ -1229,6 +1233,9 @@ function updateit() {
<br><br>
<button onclick="window.location.href='./index.php'" class="btn btn-primary btn-blue">Zurück</button>
<br><br>
<div class="row">
<div style="height:300px;" id="gsidiv"></div>
</div>
<div class="row">
Ladestatus Änderungen:
</div>
Expand All @@ -1249,6 +1256,6 @@ function updateit() {
<script src="js/typewriter.js"></script>
<script src="js/jquery.onepagenav.js"></script>
<script src="js/main.js"></script>
<script type='text/javascript'>
</body>
<script src="gsigraph.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion web/version
@@ -1 +1 @@
1.49 b Beta
1.49 c Beta

0 comments on commit 0e27cbc

Please sign in to comment.