modify filemode for linux
This commit is contained in:
+264
-264
@@ -1,264 +1,264 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
$close = 0;
|
||||
function getSSLPage($url) {
|
||||
$curlSession = curl_init();
|
||||
curl_setopt($curlSession, CURLOPT_URL, $url);
|
||||
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
||||
$jsonData = json_decode(curl_exec($curlSession),true);
|
||||
curl_close($curlSession);
|
||||
return $jsonData;
|
||||
}
|
||||
|
||||
if (checkLogin()) {
|
||||
if (isset($_POST["sensorSelect1"])) { //if form war sent add an action
|
||||
if(isset($_POST["floor"])){
|
||||
switch($_POST["floor"]){
|
||||
case "UG":
|
||||
$floor = "UG";
|
||||
break;
|
||||
case "EG":
|
||||
$floor = "EG";
|
||||
break;
|
||||
case "OG":
|
||||
$floor = "OG";
|
||||
break;
|
||||
default:
|
||||
$floor = "";
|
||||
}
|
||||
}else{
|
||||
$floor = "";
|
||||
}
|
||||
if(isset($_POST["tSpanFrom"])){
|
||||
$tFrom = date("Y-m-d H:i:s",strtotime($_POST["tSpanFrom"]));
|
||||
}else{
|
||||
$tFrom = "00:10:00";
|
||||
}
|
||||
if(isset($_POST["tSpanTo"])){
|
||||
$tTo = date("Y-m-d H:i:s",strtotime($_POST["tSpanTo"]));
|
||||
}else{
|
||||
$tTo = "23:59:00";
|
||||
}
|
||||
if(isset($_POST["runOnce"])){
|
||||
$force = true;
|
||||
}else{
|
||||
$force = false;
|
||||
}
|
||||
if(isset($_POST["actMo"])){$mo = true;}else{$mo = false;}
|
||||
if(isset($_POST["actDi"])){$di = true;}else{$di = false;}
|
||||
if(isset($_POST["actMi"])){$mi = true;}else{$mi = false;}
|
||||
if(isset($_POST["actDo"])){$do = true;}else{$do = false;}
|
||||
if(isset($_POST["actFr"])){$fr = true;}else{$fr = false;}
|
||||
if(isset($_POST["actSa"])){$sa = true;}else{$sa = false;}
|
||||
if(isset($_POST["actSo"])){$so = true;}else{$so = false;}
|
||||
if(isset($_POST["actFerien"])){$ferien = true;}else{$ferien = false;}
|
||||
if(isset($_POST["actFeier"])){$feiertag = true;}else{$feiertag = false;}
|
||||
$close = 0;
|
||||
if(isset($_POST["changeID"])){
|
||||
$id = intval($_POST["changeID"]);
|
||||
if($_POST["changeID"] != "0" && $id == 0){
|
||||
$id = -1;
|
||||
}
|
||||
}else{
|
||||
$id = -1;
|
||||
}
|
||||
$id = 2;
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
|
||||
if($id > -1){
|
||||
$qry = "UPDATE autoActions SET
|
||||
`floor` = '".$floor."', `window_from`= '".$tFrom."', `window_to` = '".$tTo."',
|
||||
`force_once` = '".$force."', `mo` = '".$mo."', `di` = '".$di."', `mi` = '".$mi."',
|
||||
`do` = '".$do."', `fr` = '".$fr."', `sa` = '".$sa."', `so` = '".$so."',
|
||||
`ferien` = '".$ferien."', `feiertag` = '".$feiertag."' WHERE id=".$id.";";
|
||||
mysqli_query($mysql, $qry);
|
||||
mysqli_query($mysql, "DELETE FROM autoactionsActors WHERE actionID=".$id.";");
|
||||
mysqli_query($mysql, "DELETE FROM autoactionsSensors WHERE actionID=".$id.";");
|
||||
$actionID = $id;
|
||||
}else{
|
||||
$qry = "INSERT into autoActions
|
||||
(`id`, `floor`, `window_from`, `window_to`, `force_once`, `mo`, `di`, `mi`, `do`, `fr`, `sa`, `so`, `ferien`, `feiertag`, `last_run`)
|
||||
VALUES (NULL, '".$floor."', '".$tFrom."', '".$tTo."', '".$force."', '".$mo."', '".$di."', '".$mi."', '".$do."', '".$fr."', '".$sa."', '".$so."', '".$ferien."', '".$feiertag."', '2020-01-01 12:00:00.000000')";
|
||||
mysqli_query($mysql, $qry);
|
||||
$actionID = mysqli_insert_id($mysql);
|
||||
}
|
||||
|
||||
//Get all Sensors:
|
||||
$num=1;
|
||||
while(isset($_POST["sensorSelect".$num])){
|
||||
$id = intval($_POST["sensorSelect".$num]);
|
||||
if($_POST["sensorSelect".$num] != "0" && $id == 0){
|
||||
$id = -1;
|
||||
}
|
||||
if(isset($_POST["btnLogic".$num])){
|
||||
if(strtolower($_POST["btnLogic".$num]) == "oder"){
|
||||
$weight = "or";
|
||||
}else{
|
||||
$weight = "and";
|
||||
}
|
||||
}else{
|
||||
$weight = "and";
|
||||
}
|
||||
if (in_array($_POST["btnOperator".$num], array('+','-','=','<','>','!='))) {
|
||||
$cond = $_POST["btnOperator".$num];
|
||||
}else{
|
||||
$cond = "=";
|
||||
echo $_POST["btnOperator".$num];
|
||||
}
|
||||
echo $_POST["btnOperator".$num];
|
||||
$valID = intval($_POST["paramSelect".$num]);
|
||||
if($_POST["paramSelect".$num] != "0" && $id == 0){
|
||||
$valID = -1;
|
||||
}
|
||||
$state = mysqli_real_escape_string($mysql, $_POST["threshold".$num]);
|
||||
|
||||
$qry = "INSERT INTO `autoactionsSensors`
|
||||
(`id`, `sensorID`, `state`, `valID`, `condType`, `link`, `actionID`)
|
||||
VALUES (NULL, '".$id."', '".$state."', '".$valID."', '".$cond."', '".$weight."', '".$actionID."')";
|
||||
mysqli_query($mysql, $qry);
|
||||
$num++;
|
||||
}
|
||||
$close=1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<!--begin::Form-->
|
||||
<form id="heater_form">
|
||||
<div class="accordion" id="actionAccordion">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
|
||||
<i class="bi bi-lightning-fill"></i> Auslöser
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#actionAccordion">
|
||||
<div class="accordion-body" id="sensorsList">
|
||||
<div class="input-group mb-1" id="sensorSettings1">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" id="sensorSelect1" name="sensorSelect1" aria-label="Default select example">
|
||||
</select>
|
||||
<label for="sensorSelect1">Sensor</label>
|
||||
</div>
|
||||
<div class="form-floating" id="paramBlock1">
|
||||
<select class="form-select" id="paramSelect1" name="paramSelect1" aria-label="Default select example">
|
||||
</select>
|
||||
<label for="paramSelect1">Messwert</label>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary " type="button" id="btnOperator1" name="btnOperator1">></button>
|
||||
<div class="form-floating" id="valBlock1">
|
||||
<input type="number" class="form-control" id="threshold1" placeholder="0" value="0" name="threshold1"></input>
|
||||
<label for="threshold1">Wert/Schwelle</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-outline-success btn-sm" type="button" id="btnAddSensor"><i class="bi bi-plus-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
|
||||
<i class="bi bi-calendar-check-fill"></i> Bedingungen
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#actionAccordion">
|
||||
<div class="accordion-body">
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<span class="input-group-text">Aktiver Zeitraum: </span>
|
||||
<div class="form-floating">
|
||||
<input type="time" class="form-control" id="tSpanFrom" name="tSpanFrom" placeholder="0" value="00:00"></input>
|
||||
<label>Von</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="time" class="form-control" id="tSpanTo" name="tSpanTo" placeholder="0" value="23:59"></input>
|
||||
<label>Bis</label>
|
||||
</div>
|
||||
</div>
|
||||
Aktive Wochentage:
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actMo" name="actMo"><label class="form-check-label" for="actMo">Mo</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actDi" name="actDi"><label class="form-check-label" for="actDi">Di</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actMi" name="actMi"><label class="form-check-label" for="actMi">Mi</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actDo" name="actDo"><label class="form-check-label" for="actDo">Do</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actFr" name="actFr"><label class="form-check-label" for="actFr">Fr</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actSa" name="actSa"><label class="form-check-label" for="actSa">Sa</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actSo" name="actSo"><label class="form-check-label" for="actSo">So</label>
|
||||
</div>
|
||||
</div>
|
||||
Ferien/Feiertage:
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-2" type="checkbox" value="1" id="actFerien" name="actFerien"><label class="form-check-label" for="actFerien">In den Ferien ausführen</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-2" type="checkbox" value="1" id="actFeier" name="actFeier"><label class="form-check-label" for="actFeier">An Feiertagen ausführen</label>
|
||||
</div>
|
||||
</div>
|
||||
Falls die Bedingung bis zuletzt nicht erfüllt wurde:
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-2" type="checkbox" value="1" id="runOnce" name="runOnce"><label class="form-check-label" for="runOnce">Auf jeden Fall zu Ende des aktiven Zeitraums ausführen</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingThree">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
|
||||
<i class="bi bi-play-fill"></i> Aktionen
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#actionAccordion">
|
||||
<div class="accordion-body">
|
||||
<div class="accordion-body" id="actorsList">
|
||||
<div class="input-group mb-3" id="actorSettings1">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" id="actorSelect1" name="actorSelect1">
|
||||
</select>
|
||||
<label for="actorSelect1">Aktor</label>
|
||||
</div>
|
||||
<div class="form-floating" id="actParamBlock1">
|
||||
<select class="form-select" id="actParamSelect1" name="actParamSelect1">
|
||||
</select>
|
||||
<label for="paramSelect1">Eigenschaft</label>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary " type="button" id="btnActOperator1" name="btnActOperator1">></button>
|
||||
<div class="form-floating" id="actValBlock1">
|
||||
<input type="number" class="form-control" id="actValue1" name="actValue1" placeholder="0" value="0"></input>
|
||||
<label for="actValue1">Sollwert</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-outline-success btn-sm" type="button" id="btnAddActor"><i class="bi bi-plus-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
$close = 0;
|
||||
function getSSLPage($url) {
|
||||
$curlSession = curl_init();
|
||||
curl_setopt($curlSession, CURLOPT_URL, $url);
|
||||
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
||||
$jsonData = json_decode(curl_exec($curlSession),true);
|
||||
curl_close($curlSession);
|
||||
return $jsonData;
|
||||
}
|
||||
|
||||
if (checkLogin()) {
|
||||
if (isset($_POST["sensorSelect1"])) { //if form war sent add an action
|
||||
if(isset($_POST["floor"])){
|
||||
switch($_POST["floor"]){
|
||||
case "UG":
|
||||
$floor = "UG";
|
||||
break;
|
||||
case "EG":
|
||||
$floor = "EG";
|
||||
break;
|
||||
case "OG":
|
||||
$floor = "OG";
|
||||
break;
|
||||
default:
|
||||
$floor = "";
|
||||
}
|
||||
}else{
|
||||
$floor = "";
|
||||
}
|
||||
if(isset($_POST["tSpanFrom"])){
|
||||
$tFrom = date("Y-m-d H:i:s",strtotime($_POST["tSpanFrom"]));
|
||||
}else{
|
||||
$tFrom = "00:10:00";
|
||||
}
|
||||
if(isset($_POST["tSpanTo"])){
|
||||
$tTo = date("Y-m-d H:i:s",strtotime($_POST["tSpanTo"]));
|
||||
}else{
|
||||
$tTo = "23:59:00";
|
||||
}
|
||||
if(isset($_POST["runOnce"])){
|
||||
$force = true;
|
||||
}else{
|
||||
$force = false;
|
||||
}
|
||||
if(isset($_POST["actMo"])){$mo = true;}else{$mo = false;}
|
||||
if(isset($_POST["actDi"])){$di = true;}else{$di = false;}
|
||||
if(isset($_POST["actMi"])){$mi = true;}else{$mi = false;}
|
||||
if(isset($_POST["actDo"])){$do = true;}else{$do = false;}
|
||||
if(isset($_POST["actFr"])){$fr = true;}else{$fr = false;}
|
||||
if(isset($_POST["actSa"])){$sa = true;}else{$sa = false;}
|
||||
if(isset($_POST["actSo"])){$so = true;}else{$so = false;}
|
||||
if(isset($_POST["actFerien"])){$ferien = true;}else{$ferien = false;}
|
||||
if(isset($_POST["actFeier"])){$feiertag = true;}else{$feiertag = false;}
|
||||
$close = 0;
|
||||
if(isset($_POST["changeID"])){
|
||||
$id = intval($_POST["changeID"]);
|
||||
if($_POST["changeID"] != "0" && $id == 0){
|
||||
$id = -1;
|
||||
}
|
||||
}else{
|
||||
$id = -1;
|
||||
}
|
||||
$id = 2;
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
|
||||
if($id > -1){
|
||||
$qry = "UPDATE autoActions SET
|
||||
`floor` = '".$floor."', `window_from`= '".$tFrom."', `window_to` = '".$tTo."',
|
||||
`force_once` = '".$force."', `mo` = '".$mo."', `di` = '".$di."', `mi` = '".$mi."',
|
||||
`do` = '".$do."', `fr` = '".$fr."', `sa` = '".$sa."', `so` = '".$so."',
|
||||
`ferien` = '".$ferien."', `feiertag` = '".$feiertag."' WHERE id=".$id.";";
|
||||
mysqli_query($mysql, $qry);
|
||||
mysqli_query($mysql, "DELETE FROM autoactionsActors WHERE actionID=".$id.";");
|
||||
mysqli_query($mysql, "DELETE FROM autoactionsSensors WHERE actionID=".$id.";");
|
||||
$actionID = $id;
|
||||
}else{
|
||||
$qry = "INSERT into autoActions
|
||||
(`id`, `floor`, `window_from`, `window_to`, `force_once`, `mo`, `di`, `mi`, `do`, `fr`, `sa`, `so`, `ferien`, `feiertag`, `last_run`)
|
||||
VALUES (NULL, '".$floor."', '".$tFrom."', '".$tTo."', '".$force."', '".$mo."', '".$di."', '".$mi."', '".$do."', '".$fr."', '".$sa."', '".$so."', '".$ferien."', '".$feiertag."', '2020-01-01 12:00:00.000000')";
|
||||
mysqli_query($mysql, $qry);
|
||||
$actionID = mysqli_insert_id($mysql);
|
||||
}
|
||||
|
||||
//Get all Sensors:
|
||||
$num=1;
|
||||
while(isset($_POST["sensorSelect".$num])){
|
||||
$id = intval($_POST["sensorSelect".$num]);
|
||||
if($_POST["sensorSelect".$num] != "0" && $id == 0){
|
||||
$id = -1;
|
||||
}
|
||||
if(isset($_POST["btnLogic".$num])){
|
||||
if(strtolower($_POST["btnLogic".$num]) == "oder"){
|
||||
$weight = "or";
|
||||
}else{
|
||||
$weight = "and";
|
||||
}
|
||||
}else{
|
||||
$weight = "and";
|
||||
}
|
||||
if (in_array($_POST["btnOperator".$num], array('+','-','=','<','>','!='))) {
|
||||
$cond = $_POST["btnOperator".$num];
|
||||
}else{
|
||||
$cond = "=";
|
||||
echo $_POST["btnOperator".$num];
|
||||
}
|
||||
echo $_POST["btnOperator".$num];
|
||||
$valID = intval($_POST["paramSelect".$num]);
|
||||
if($_POST["paramSelect".$num] != "0" && $id == 0){
|
||||
$valID = -1;
|
||||
}
|
||||
$state = mysqli_real_escape_string($mysql, $_POST["threshold".$num]);
|
||||
|
||||
$qry = "INSERT INTO `autoactionsSensors`
|
||||
(`id`, `sensorID`, `state`, `valID`, `condType`, `link`, `actionID`)
|
||||
VALUES (NULL, '".$id."', '".$state."', '".$valID."', '".$cond."', '".$weight."', '".$actionID."')";
|
||||
mysqli_query($mysql, $qry);
|
||||
$num++;
|
||||
}
|
||||
$close=1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<!--begin::Form-->
|
||||
<form id="heater_form">
|
||||
<div class="accordion" id="actionAccordion">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
|
||||
<i class="bi bi-lightning-fill"></i> Auslöser
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#actionAccordion">
|
||||
<div class="accordion-body" id="sensorsList">
|
||||
<div class="input-group mb-1" id="sensorSettings1">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" id="sensorSelect1" name="sensorSelect1" aria-label="Default select example">
|
||||
</select>
|
||||
<label for="sensorSelect1">Sensor</label>
|
||||
</div>
|
||||
<div class="form-floating" id="paramBlock1">
|
||||
<select class="form-select" id="paramSelect1" name="paramSelect1" aria-label="Default select example">
|
||||
</select>
|
||||
<label for="paramSelect1">Messwert</label>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary " type="button" id="btnOperator1" name="btnOperator1">></button>
|
||||
<div class="form-floating" id="valBlock1">
|
||||
<input type="number" class="form-control" id="threshold1" placeholder="0" value="0" name="threshold1"></input>
|
||||
<label for="threshold1">Wert/Schwelle</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-outline-success btn-sm" type="button" id="btnAddSensor"><i class="bi bi-plus-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
|
||||
<i class="bi bi-calendar-check-fill"></i> Bedingungen
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#actionAccordion">
|
||||
<div class="accordion-body">
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<span class="input-group-text">Aktiver Zeitraum: </span>
|
||||
<div class="form-floating">
|
||||
<input type="time" class="form-control" id="tSpanFrom" name="tSpanFrom" placeholder="0" value="00:00"></input>
|
||||
<label>Von</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="time" class="form-control" id="tSpanTo" name="tSpanTo" placeholder="0" value="23:59"></input>
|
||||
<label>Bis</label>
|
||||
</div>
|
||||
</div>
|
||||
Aktive Wochentage:
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actMo" name="actMo"><label class="form-check-label" for="actMo">Mo</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actDi" name="actDi"><label class="form-check-label" for="actDi">Di</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actMi" name="actMi"><label class="form-check-label" for="actMi">Mi</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actDo" name="actDo"><label class="form-check-label" for="actDo">Do</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actFr" name="actFr"><label class="form-check-label" for="actFr">Fr</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actSa" name="actSa"><label class="form-check-label" for="actSa">Sa</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-1" type="checkbox" value="1" id="actSo" name="actSo"><label class="form-check-label" for="actSo">So</label>
|
||||
</div>
|
||||
</div>
|
||||
Ferien/Feiertage:
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-2" type="checkbox" value="1" id="actFerien" name="actFerien"><label class="form-check-label" for="actFerien">In den Ferien ausführen</label>
|
||||
</div>
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-2" type="checkbox" value="1" id="actFeier" name="actFeier"><label class="form-check-label" for="actFeier">An Feiertagen ausführen</label>
|
||||
</div>
|
||||
</div>
|
||||
Falls die Bedingung bis zuletzt nicht erfüllt wurde:
|
||||
<div class="input-group mb-3" id="timespan">
|
||||
<div class="input-group-text">
|
||||
<input class="form-check-input mt-0 me-2" type="checkbox" value="1" id="runOnce" name="runOnce"><label class="form-check-label" for="runOnce">Auf jeden Fall zu Ende des aktiven Zeitraums ausführen</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="headingThree">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
|
||||
<i class="bi bi-play-fill"></i> Aktionen
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#actionAccordion">
|
||||
<div class="accordion-body">
|
||||
<div class="accordion-body" id="actorsList">
|
||||
<div class="input-group mb-3" id="actorSettings1">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" id="actorSelect1" name="actorSelect1">
|
||||
</select>
|
||||
<label for="actorSelect1">Aktor</label>
|
||||
</div>
|
||||
<div class="form-floating" id="actParamBlock1">
|
||||
<select class="form-select" id="actParamSelect1" name="actParamSelect1">
|
||||
</select>
|
||||
<label for="paramSelect1">Eigenschaft</label>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary " type="button" id="btnActOperator1" name="btnActOperator1">></button>
|
||||
<div class="form-floating" id="actValBlock1">
|
||||
<input type="number" class="form-control" id="actValue1" name="actValue1" placeholder="0" value="0"></input>
|
||||
<label for="actValue1">Sollwert</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-outline-success btn-sm" type="button" id="btnAddActor"><i class="bi bi-plus-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
if(isset($_GET["actorID"])){
|
||||
$ID = intval($_GET["actorID"]);
|
||||
$qry = "SELECT parameters FROM actors WHERE id=".$ID;
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
echo $result->fetch_array()[0];
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
if(isset($_GET["actorID"])){
|
||||
$ID = intval($_GET["actorID"]);
|
||||
$qry = "SELECT parameters FROM actors WHERE id=".$ID;
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
echo $result->fetch_array()[0];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
+140
-140
@@ -1,141 +1,141 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
if (checkLogin()) {
|
||||
chdir("/volume1/homes/wagner/");
|
||||
putenv('PYTHONPATH="/var/services/homes/wagner/.local/lib/python3.8/site-packages/');
|
||||
$close = 0;
|
||||
if (isset($_POST["evStart/Stop"])) {
|
||||
if ($_POST["evStart/Stop"] == "Laden starten") {
|
||||
$close = 1;
|
||||
exec("python wattpilot.py -start 2>&1", $output, $return_var);
|
||||
} elseif ($_POST["evStart/Stop"] == "Laden stoppen") {
|
||||
$close = 1;
|
||||
exec("python wattpilot.py -stop 2>&1", $output, $return_var);
|
||||
}
|
||||
$close = 1;
|
||||
} else if (isset($_POST["evMode"])) {
|
||||
if ($_POST["fte"] > 100)
|
||||
$_POST["fte"] = 100;
|
||||
else if ($_POST["fte"] < 1)
|
||||
$_POST["fte"] = 1;
|
||||
|
||||
if ($_POST["evAmp"] > 16)
|
||||
$_POST["evAmp"] = 16;
|
||||
if ($_POST["evAmp"] < 6)
|
||||
$_POST["evAmp"] = 6;
|
||||
$_POST["fte"] = $_POST["fte"] * 140;
|
||||
|
||||
if ($_POST["evMode"] == "eco") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
exec("python wattpilot.py -eco -time " . $_POST["ftt"] . " -energy " . $_POST["fte"] . " -maxCurr " . $_POST["evAmp"] . " -setTime " . gmdate("Y-m-d\TH:i:s", time()) . ".000 2>&1", $output, $return_var);
|
||||
} else {
|
||||
exec("/bin/python wattpilot.py -e 2>&1", $output, $return_var);
|
||||
}
|
||||
} else if ($_POST["evMode"] == "default") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
exec("python wattpilot.py -default -time " . $_POST["ftt"] . " -energy " . $_POST["fte"] . " -maxCurr " . $_POST["evAmp"] . " -setTime " . gmdate("Y-m-d\TH:i:s", time()) . ".000 2>&1", $output, $return_var);
|
||||
} else {
|
||||
exec("python wattpilot.py -d 2>&1", $output, $return_var);
|
||||
}
|
||||
} else if ($_POST["evMode"] == "NextTrip") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
exec("python wattpilot.py -trip -time " . $_POST["ftt"] . " -energy " . $_POST["fte"] . " -maxCurr " . $_POST["evAmp"] . " -setTime " . gmdate("Y-m-d\TH:i:s", time()) . ".000 2>&1", $output, $return_var);
|
||||
} else {
|
||||
exec("python wattpilot.py -t 2>&1", $output, $return_var);
|
||||
}
|
||||
}
|
||||
$close = 1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<div class="d-grid gap-2 col-6 mx-auto my-4">
|
||||
<button class="btn btn-primary" id="evStart/Stop">Laden starten</button>
|
||||
</div>
|
||||
<!--begin::Form-->
|
||||
<form id="carEG_form">
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Modus</div>
|
||||
</div>
|
||||
<!--begin::Body-->
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Default" value="default">
|
||||
<label class="form-check-label" for="EV_Default"> Immer Laden </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Eco" value="eco">
|
||||
<label class="form-check-label" for="EV_Eco"> Überschuss </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_NextTrip" value="NextTrip">
|
||||
<label class="form-check-label" for="EV_NextTrip"> Ladeplanung </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Max. Ladestrom</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_6A" value="6">
|
||||
<label class="form-check-label" for="EV_6A"> 6A </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_10A" value="10">
|
||||
<label class="form-check-label" for="EV_10A"> 10A </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_16A" value="16">
|
||||
<label class="form-check-label" for="EV_16A"> 16A </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Ladeplanung</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Zusätzlich benötigte Ladung (%): </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">sdf</div>
|
||||
<input type="range" id="modal-slider" name="fte" class="form-range range-color-track" min="1" max="100" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">1%</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">100%</span>
|
||||
</div>
|
||||
<!--<input name="fte" class="form-control" type="number" max="100" min="1" value="" />-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="planedTime">Zeitpunkt zudem geladen sein soll: </label>
|
||||
<input id="EV_NextTripTime" name="ftt" class="form-control" size="2" type="time" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
if (checkLogin()) {
|
||||
chdir("/volume1/homes/wagner/");
|
||||
putenv('PYTHONPATH="/var/services/homes/wagner/.local/lib/python3.8/site-packages/');
|
||||
$close = 0;
|
||||
if (isset($_POST["evStart/Stop"])) {
|
||||
if ($_POST["evStart/Stop"] == "Laden starten") {
|
||||
$close = 1;
|
||||
exec("python wattpilot.py -start 2>&1", $output, $return_var);
|
||||
} elseif ($_POST["evStart/Stop"] == "Laden stoppen") {
|
||||
$close = 1;
|
||||
exec("python wattpilot.py -stop 2>&1", $output, $return_var);
|
||||
}
|
||||
$close = 1;
|
||||
} else if (isset($_POST["evMode"])) {
|
||||
if ($_POST["fte"] > 100)
|
||||
$_POST["fte"] = 100;
|
||||
else if ($_POST["fte"] < 1)
|
||||
$_POST["fte"] = 1;
|
||||
|
||||
if ($_POST["evAmp"] > 16)
|
||||
$_POST["evAmp"] = 16;
|
||||
if ($_POST["evAmp"] < 6)
|
||||
$_POST["evAmp"] = 6;
|
||||
$_POST["fte"] = $_POST["fte"] * 140;
|
||||
|
||||
if ($_POST["evMode"] == "eco") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
exec("python wattpilot.py -eco -time " . $_POST["ftt"] . " -energy " . $_POST["fte"] . " -maxCurr " . $_POST["evAmp"] . " -setTime " . gmdate("Y-m-d\TH:i:s", time()) . ".000 2>&1", $output, $return_var);
|
||||
} else {
|
||||
exec("/bin/python wattpilot.py -e 2>&1", $output, $return_var);
|
||||
}
|
||||
} else if ($_POST["evMode"] == "default") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
exec("python wattpilot.py -default -time " . $_POST["ftt"] . " -energy " . $_POST["fte"] . " -maxCurr " . $_POST["evAmp"] . " -setTime " . gmdate("Y-m-d\TH:i:s", time()) . ".000 2>&1", $output, $return_var);
|
||||
} else {
|
||||
exec("python wattpilot.py -d 2>&1", $output, $return_var);
|
||||
}
|
||||
} else if ($_POST["evMode"] == "NextTrip") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
exec("python wattpilot.py -trip -time " . $_POST["ftt"] . " -energy " . $_POST["fte"] . " -maxCurr " . $_POST["evAmp"] . " -setTime " . gmdate("Y-m-d\TH:i:s", time()) . ".000 2>&1", $output, $return_var);
|
||||
} else {
|
||||
exec("python wattpilot.py -t 2>&1", $output, $return_var);
|
||||
}
|
||||
}
|
||||
$close = 1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<div class="d-grid gap-2 col-6 mx-auto my-4">
|
||||
<button class="btn btn-primary" id="evStart/Stop">Laden starten</button>
|
||||
</div>
|
||||
<!--begin::Form-->
|
||||
<form id="carEG_form">
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Modus</div>
|
||||
</div>
|
||||
<!--begin::Body-->
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Default" value="default">
|
||||
<label class="form-check-label" for="EV_Default"> Immer Laden </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Eco" value="eco">
|
||||
<label class="form-check-label" for="EV_Eco"> Überschuss </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_NextTrip" value="NextTrip">
|
||||
<label class="form-check-label" for="EV_NextTrip"> Ladeplanung </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Max. Ladestrom</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_6A" value="6">
|
||||
<label class="form-check-label" for="EV_6A"> 6A </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_10A" value="10">
|
||||
<label class="form-check-label" for="EV_10A"> 10A </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_16A" value="16">
|
||||
<label class="form-check-label" for="EV_16A"> 16A </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Ladeplanung</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Zusätzlich benötigte Ladung (%): </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">sdf</div>
|
||||
<input type="range" id="modal-slider" name="fte" class="form-range range-color-track" min="1" max="100" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">1%</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">100%</span>
|
||||
</div>
|
||||
<!--<input name="fte" class="form-control" type="number" max="100" min="1" value="" />-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="planedTime">Zeitpunkt zudem geladen sein soll: </label>
|
||||
<input id="EV_NextTripTime" name="ftt" class="form-control" size="2" type="time" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
+148
-148
@@ -1,148 +1,148 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
function getSSLPage($url) {
|
||||
$curlSession = curl_init();
|
||||
curl_setopt($curlSession, CURLOPT_URL, $url);
|
||||
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
||||
$jsonData = json_decode(curl_exec($curlSession),true);
|
||||
curl_close($curlSession);
|
||||
return $jsonData;
|
||||
}
|
||||
|
||||
if (checkLogin()) {
|
||||
$close = 0;
|
||||
if (isset($_POST["evStart/Stop"])) {
|
||||
if ($_POST["evStart/Stop"] == "Laden starten") {
|
||||
$close = 1;
|
||||
getSSLPage("http://192.168.179.122/api/set?frc=2");
|
||||
} else if ($_POST["evStart/Stop"] == "Laden stoppen") {
|
||||
$close = 1;
|
||||
getSSLPage("http://192.168.179.122/api/set?frc=1");
|
||||
}
|
||||
$close = 1;
|
||||
} else if (isset($_POST["evMode"])) {
|
||||
if ($_POST["fte"] > 100)
|
||||
$_POST["fte"] = 100;
|
||||
else if ($_POST["fte"] < 0)
|
||||
$_POST["fte"] = 0;
|
||||
if ($_POST["evAmp"] > 16)
|
||||
$_POST["evAmp"] = 16;
|
||||
if ($_POST["evAmp"] < 6)
|
||||
$_POST["evAmp"] = 6;
|
||||
$_POST["fte"] = $_POST["fte"] * 90;
|
||||
$seconds = strtotime('1970-01-01 ' . $_POST["ftt"] . ':00GMT');
|
||||
if ($_POST["evMode"] == "eco") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
getSSLPage("http://192.168.179.122/api/set?ate=" . $_POST["fte"] . "&att=" . $seconds . "&=" . $_POST["evAmp"] . "&fup=true&lmo=4");
|
||||
} else {
|
||||
getSSLPage("http://192.168.179.122/api/set?amp=" . $_POST["evAmp"] . "&fup=true&lmo=4");
|
||||
}
|
||||
} else if ($_POST["evMode"] == "default") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
getSSLPage("http://192.168.179.122/api/set?ate=" . $_POST["fte"] . "&att=" . $seconds . "&=" . $_POST["evAmp"] . "&fup=true&lmo=3");
|
||||
} else {
|
||||
getSSLPage("http://192.168.179.122/api/set?amp=" . $_POST["evAmp"] . "&fup=true&lmo=3");
|
||||
}
|
||||
} else if ($_POST["evMode"] == "NextTrip") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
getSSLPage("http://192.168.179.122/api/set?ate=" . $_POST["fte"] . "&att=" . $seconds . "&=" . $_POST["evAmp"] . "&fup=true&lmo=5");
|
||||
} else {
|
||||
getSSLPage("http://192.168.179.122/api/set?amp=" . $_POST["evAmp"] . "&fup=true&lmo=5");
|
||||
}
|
||||
}
|
||||
$close = 1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<div class="d-grid gap-2 col-6 mx-auto my-4">
|
||||
<button class="btn btn-primary" id="evStart/Stop">Laden starten</button>
|
||||
</div>
|
||||
<!--begin::Form-->
|
||||
<form id="carOG_form">
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Modus</div>
|
||||
</div>
|
||||
<!--begin::Body-->
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Default" value="default">
|
||||
<label class="form-check-label" for="EV_Default"> Immer Laden </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Eco" value="eco">
|
||||
<label class="form-check-label" for="EV_Eco"> Überschuss </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_NextTrip" value="NextTrip">
|
||||
<label class="form-check-label" for="EV_NextTrip"> Ladeplanung </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Max. Ladestrom</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_6A" value="6">
|
||||
<label class="form-check-label" for="EV_6A"> 6A </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_10A" value="10">
|
||||
<label class="form-check-label" for="EV_10A"> 10A </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_16A" value="16">
|
||||
<label class="form-check-label" for="EV_16A"> 16A </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Ladeplanung</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Zusätzlich benötigte Ladung (%): </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">sdf</div>
|
||||
<input type="range" id="modal-slider" name="fte" class="form-range range-color-track" min="1" max="100" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">1%</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">100%</span>
|
||||
</div>
|
||||
<!--<input name="fte" class="form-control" type="number" max="100" min="1" value="" />-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="planedTime">Zeitpunkt zudem geladen sein soll: </label>
|
||||
<input id="EV_NextTripTime" name="ftt" class="form-control" size="2" type="time" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
function getSSLPage($url) {
|
||||
$curlSession = curl_init();
|
||||
curl_setopt($curlSession, CURLOPT_URL, $url);
|
||||
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
||||
$jsonData = json_decode(curl_exec($curlSession),true);
|
||||
curl_close($curlSession);
|
||||
return $jsonData;
|
||||
}
|
||||
|
||||
if (checkLogin()) {
|
||||
$close = 0;
|
||||
if (isset($_POST["evStart/Stop"])) {
|
||||
if ($_POST["evStart/Stop"] == "Laden starten") {
|
||||
$close = 1;
|
||||
getSSLPage("http://192.168.179.122/api/set?frc=2");
|
||||
} else if ($_POST["evStart/Stop"] == "Laden stoppen") {
|
||||
$close = 1;
|
||||
getSSLPage("http://192.168.179.122/api/set?frc=1");
|
||||
}
|
||||
$close = 1;
|
||||
} else if (isset($_POST["evMode"])) {
|
||||
if ($_POST["fte"] > 100)
|
||||
$_POST["fte"] = 100;
|
||||
else if ($_POST["fte"] < 0)
|
||||
$_POST["fte"] = 0;
|
||||
if ($_POST["evAmp"] > 16)
|
||||
$_POST["evAmp"] = 16;
|
||||
if ($_POST["evAmp"] < 6)
|
||||
$_POST["evAmp"] = 6;
|
||||
$_POST["fte"] = $_POST["fte"] * 90;
|
||||
$seconds = strtotime('1970-01-01 ' . $_POST["ftt"] . ':00GMT');
|
||||
if ($_POST["evMode"] == "eco") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
getSSLPage("http://192.168.179.122/api/set?ate=" . $_POST["fte"] . "&att=" . $seconds . "&=" . $_POST["evAmp"] . "&fup=true&lmo=4");
|
||||
} else {
|
||||
getSSLPage("http://192.168.179.122/api/set?amp=" . $_POST["evAmp"] . "&fup=true&lmo=4");
|
||||
}
|
||||
} else if ($_POST["evMode"] == "default") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
getSSLPage("http://192.168.179.122/api/set?ate=" . $_POST["fte"] . "&att=" . $seconds . "&=" . $_POST["evAmp"] . "&fup=true&lmo=3");
|
||||
} else {
|
||||
getSSLPage("http://192.168.179.122/api/set?amp=" . $_POST["evAmp"] . "&fup=true&lmo=3");
|
||||
}
|
||||
} else if ($_POST["evMode"] == "NextTrip") {
|
||||
$close = 1;
|
||||
if ($_POST["ftt"] && $_POST["fte"] > 0) {
|
||||
getSSLPage("http://192.168.179.122/api/set?ate=" . $_POST["fte"] . "&att=" . $seconds . "&=" . $_POST["evAmp"] . "&fup=true&lmo=5");
|
||||
} else {
|
||||
getSSLPage("http://192.168.179.122/api/set?amp=" . $_POST["evAmp"] . "&fup=true&lmo=5");
|
||||
}
|
||||
}
|
||||
$close = 1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<div class="d-grid gap-2 col-6 mx-auto my-4">
|
||||
<button class="btn btn-primary" id="evStart/Stop">Laden starten</button>
|
||||
</div>
|
||||
<!--begin::Form-->
|
||||
<form id="carOG_form">
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Modus</div>
|
||||
</div>
|
||||
<!--begin::Body-->
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Default" value="default">
|
||||
<label class="form-check-label" for="EV_Default"> Immer Laden </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_Eco" value="eco">
|
||||
<label class="form-check-label" for="EV_Eco"> Überschuss </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evMode" id="EV_NextTrip" value="NextTrip">
|
||||
<label class="form-check-label" for="EV_NextTrip"> Ladeplanung </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Max. Ladestrom</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_6A" value="6">
|
||||
<label class="form-check-label" for="EV_6A"> 6A </label></input>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_10A" value="10">
|
||||
<label class="form-check-label" for="EV_10A"> 10A </label></input>
|
||||
</div>
|
||||
<div class="form-check disabled">
|
||||
<input class="form-check-input" type="radio" name="evAmp" id="EV_16A" value="16">
|
||||
<label class="form-check-label" for="EV_16A"> 16A </label></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-3">
|
||||
<div class="card-header py-1 px-3">
|
||||
<div class="card-title">Ladeplanung</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Zusätzlich benötigte Ladung (%): </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">sdf</div>
|
||||
<input type="range" id="modal-slider" name="fte" class="form-range range-color-track" min="1" max="100" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">1%</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">100%</span>
|
||||
</div>
|
||||
<!--<input name="fte" class="form-control" type="number" max="100" min="1" value="" />-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="planedTime">Zeitpunkt zudem geladen sein soll: </label>
|
||||
<input id="EV_NextTripTime" name="ftt" class="form-control" size="2" type="time" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
$qry = "SELECT name, id FROM actors";
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
|
||||
while($row = $result->fetch_assoc()){
|
||||
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
|
||||
}
|
||||
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
$qry = "SELECT name, id FROM actors";
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
|
||||
while($row = $result->fetch_assoc()){
|
||||
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
$qry = "SELECT name, id FROM sensors";
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
|
||||
while($row = $result->fetch_assoc()){
|
||||
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
|
||||
}
|
||||
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
$qry = "SELECT name, id FROM sensors";
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
|
||||
while($row = $result->fetch_assoc()){
|
||||
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
+161
-161
@@ -1,162 +1,162 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["TO"])){
|
||||
$_GET["TO"] = 12;
|
||||
}
|
||||
$_GET["TO"] = intval($_GET["TO"]);
|
||||
if(!isset($_GET["FROM"])){
|
||||
$_GET["FROM"] = -24;
|
||||
}
|
||||
$_GET["FROM"] = intval($_GET["FROM"]);
|
||||
//-totalConsumption-PL1_EV*1000-PL2_EV*1000-PL3_EV*1000-PL1_EVog*1000-PL2_EVog*1000-PL3_EVog*1000+PL1_OG+PL2_OG+PL3_OG-heaterPwr AS 'UG',
|
||||
$consQuery = "SELECT
|
||||
UNIX_TIMESTAMP(EnergyFlow.datetime) AS time,
|
||||
pvP AS 'Solarleistung',
|
||||
soc AS Ladestand,
|
||||
-totalConsumption-PL1_EV*1000-PL2_EV*1000-PL3_EV*1000-PL1_EVog*1000-PL2_EVog*1000-PL3_EVog*1000+PL1_OG+PL2_OG+PL3_OG-heaterPwr-PL1_UG-PL2_UG-PL3_UG-PL1_EG-PL2_EG-PL3_EG AS 'Gemein',
|
||||
(PL1_UG+PL2_UG+PL3_UG) AS 'UG',
|
||||
(PL1_EG+PL2_EG+PL3_EG) AS 'EG',
|
||||
-(PL1_OG+PL2_OG+PL3_OG) AS 'OG',
|
||||
(PL1_EV+PL2_EV+PL3_EV)*1000 AS 'Auto UG',
|
||||
(PL1_EVog+PL2_EVog+PL3_EVog)*1000 AS 'Auto OG',
|
||||
heaterPwr AS 'Heizstab',
|
||||
IF(battP<0, -battP, 0) AS Batterieladung,
|
||||
gridPfeed AS Einspeisung
|
||||
FROM solarLog.EnergyFlow
|
||||
WHERE EnergyFlow.datetime BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY EnergyFlow.datetime";
|
||||
$simQuery = "SELECT
|
||||
UNIX_TIMESTAMP(simPower.period_end) AS time,
|
||||
power*1000 AS 'Vorhersage'
|
||||
FROM solarLog.simPower
|
||||
WHERE simPower.period_end BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY simPower.period_end";
|
||||
$linecolors["Solarleistung"] = "#FFFF00";
|
||||
$linecolors["Gemein"] = "#FF9900";
|
||||
$linecolors["UG"] = "#FF8800";
|
||||
$linecolors["EG"] = "#FF6600";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF0000";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
$simRes = mysqli_query($mysql,$simQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($simRes->num_rows > 1) {
|
||||
$dataset = (object)[];
|
||||
$row1 = $simRes->fetch_assoc();
|
||||
$dataset->borderColor = $linecolors["Vorhersage"];
|
||||
$dataset->backgroundColor = $linecolors["Vorhersage"]."55";
|
||||
$dataset->borderWidth=1.5;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = "sim";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = "Vorhersage";
|
||||
/*$pt = (object)[];
|
||||
$pt->x = $row1["time"]*1000;
|
||||
$pt->y = $row1["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
while ($row1 = $simRes->fetch_assoc()) {
|
||||
$pt = (object)[];
|
||||
$pt->x = $row1["time"]*1000 + 30*60*1000;
|
||||
$pt->y = $row1["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
}*/
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
}
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 1;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
if(($value * 1000) < $nextSimTimestamp){
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}else{
|
||||
$row1 = $rownext;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$obj->labels[] = $nextSimTimestamp; //Draw future forecast
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
while($rownext = $simRes->fetch_assoc()){
|
||||
$obj->labels[] = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["TO"])){
|
||||
$_GET["TO"] = 12;
|
||||
}
|
||||
$_GET["TO"] = intval($_GET["TO"]);
|
||||
if(!isset($_GET["FROM"])){
|
||||
$_GET["FROM"] = -24;
|
||||
}
|
||||
$_GET["FROM"] = intval($_GET["FROM"]);
|
||||
//-totalConsumption-PL1_EV*1000-PL2_EV*1000-PL3_EV*1000-PL1_EVog*1000-PL2_EVog*1000-PL3_EVog*1000+PL1_OG+PL2_OG+PL3_OG-heaterPwr AS 'UG',
|
||||
$consQuery = "SELECT
|
||||
UNIX_TIMESTAMP(EnergyFlow.datetime) AS time,
|
||||
pvP AS 'Solarleistung',
|
||||
soc AS Ladestand,
|
||||
-totalConsumption-PL1_EV*1000-PL2_EV*1000-PL3_EV*1000-PL1_EVog*1000-PL2_EVog*1000-PL3_EVog*1000+PL1_OG+PL2_OG+PL3_OG-heaterPwr-PL1_UG-PL2_UG-PL3_UG-PL1_EG-PL2_EG-PL3_EG AS 'Gemein',
|
||||
(PL1_UG+PL2_UG+PL3_UG) AS 'UG',
|
||||
(PL1_EG+PL2_EG+PL3_EG) AS 'EG',
|
||||
-(PL1_OG+PL2_OG+PL3_OG) AS 'OG',
|
||||
(PL1_EV+PL2_EV+PL3_EV)*1000 AS 'Auto UG',
|
||||
(PL1_EVog+PL2_EVog+PL3_EVog)*1000 AS 'Auto OG',
|
||||
heaterPwr AS 'Heizstab',
|
||||
IF(battP<0, -battP, 0) AS Batterieladung,
|
||||
gridPfeed AS Einspeisung
|
||||
FROM solarLog.EnergyFlow
|
||||
WHERE EnergyFlow.datetime BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY EnergyFlow.datetime";
|
||||
$simQuery = "SELECT
|
||||
UNIX_TIMESTAMP(simPower.period_end) AS time,
|
||||
power*1000 AS 'Vorhersage'
|
||||
FROM solarLog.simPower
|
||||
WHERE simPower.period_end BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY simPower.period_end";
|
||||
$linecolors["Solarleistung"] = "#FFFF00";
|
||||
$linecolors["Gemein"] = "#FF9900";
|
||||
$linecolors["UG"] = "#FF8800";
|
||||
$linecolors["EG"] = "#FF6600";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF0000";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
$simRes = mysqli_query($mysql,$simQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($simRes->num_rows > 1) {
|
||||
$dataset = (object)[];
|
||||
$row1 = $simRes->fetch_assoc();
|
||||
$dataset->borderColor = $linecolors["Vorhersage"];
|
||||
$dataset->backgroundColor = $linecolors["Vorhersage"]."55";
|
||||
$dataset->borderWidth=1.5;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = "sim";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = "Vorhersage";
|
||||
/*$pt = (object)[];
|
||||
$pt->x = $row1["time"]*1000;
|
||||
$pt->y = $row1["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
while ($row1 = $simRes->fetch_assoc()) {
|
||||
$pt = (object)[];
|
||||
$pt->x = $row1["time"]*1000 + 30*60*1000;
|
||||
$pt->y = $row1["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
}*/
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
}
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 1;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
if(($value * 1000) < $nextSimTimestamp){
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}else{
|
||||
$row1 = $rownext;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$obj->labels[] = $nextSimTimestamp; //Draw future forecast
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
while($rownext = $simRes->fetch_assoc()){
|
||||
$obj->labels[] = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
?>
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime,'%Y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0)- heaterPwr/12) Solarverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP > 0, battP/12,0)) AS Batteriebezug,
|
||||
SUM(gridPcons/12) AS Netzbezug
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 10 YEAR),'%Y')
|
||||
GROUP BY time
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Solarverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime,'%Y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0)- heaterPwr/12) Solarverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP > 0, battP/12,0)) AS Batteriebezug,
|
||||
SUM(gridPcons/12) AS Netzbezug
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 10 YEAR),'%Y')
|
||||
GROUP BY time
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Solarverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime, '%d.%b.') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0)- heaterPwr/12) Solarverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP > 0, battP/12,0)) AS Batteriebezug,
|
||||
SUM(gridPcons/12) AS Netzbezug
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m%d') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 MONTH),'%Y%m%d')
|
||||
GROUP BY DATE_FORMAT(datetime, '%d.%b.')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Solarverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime, '%d.%b.') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0)- heaterPwr/12) Solarverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP > 0, battP/12,0)) AS Batteriebezug,
|
||||
SUM(gridPcons/12) AS Netzbezug
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m%d') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 MONTH),'%Y%m%d')
|
||||
GROUP BY DATE_FORMAT(datetime, '%d.%b.')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Solarverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime, '%b. %y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0)- heaterPwr/12) Solarverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP > 0, battP/12,0)) AS Batteriebezug,
|
||||
SUM(gridPcons/12) AS Netzbezug
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 13 MONTH),'%Y%m')
|
||||
GROUP BY DATE_FORMAT(datetime, '%b. %y')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Solarverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime, '%b. %y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0)- heaterPwr/12) Solarverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP > 0, battP/12,0)) AS Batteriebezug,
|
||||
SUM(gridPcons/12) AS Netzbezug
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 13 MONTH),'%Y%m')
|
||||
GROUP BY DATE_FORMAT(datetime, '%b. %y')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Solarverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+175
-175
@@ -1,175 +1,175 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consEstQuery = "SELECT
|
||||
UNIX_TIMESTAMP(DATE_ADD(datetime, INTERVAL 28 DAY)) AS 'time',
|
||||
SUM(-(totalConsumption + heaterPwr)/48) AS 'Vorraussichtl. Verbrauch'
|
||||
FROM EnergyFlow
|
||||
WHERE
|
||||
DATE(datetime) >= DATE(DATE_SUB(NOW(),INTERVAL 28 DAY)) And DATE(datetime) != DATE(NOW())
|
||||
GROUP BY WEEKDAY(datetime)
|
||||
ORDER BY datetime";
|
||||
|
||||
$prodEstQuery = "SELECT UNIX_TIMESTAMP(CONVERT_TZ(period_End,'GMT','Europe/Berlin')) AS 'time',
|
||||
SUM(power*500) AS 'Vorhersage'
|
||||
FROM simPower
|
||||
WHERE DATE(CONVERT_TZ(period_End,'GMT','Europe/Berlin')) >= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY))
|
||||
GROUP BY DAY(CONVERT_TZ(period_End,'GMT','Europe/Berlin'))
|
||||
ORDER BY period_End;";
|
||||
|
||||
$prodRealQuery = "SELECT
|
||||
UNIX_TIMESTAMP(datetime) AS 'time',
|
||||
SUM(pvP/12) AS 'Tatsächliche Erzeugung',
|
||||
SUM(-totalConsumption/12) AS 'Tatsächlicher Verbrauch'
|
||||
FROM EnergyFlow
|
||||
WHERE
|
||||
DATE(datetime) >= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY))
|
||||
GROUP BY DAY(datetime)
|
||||
ORDER BY datetime";
|
||||
|
||||
|
||||
$linecolors["Tatsächliche Erzeugung"] = "#cccc00";
|
||||
$linecolors["Tatsächlicher Verbrauch"] = "#EE9900";
|
||||
$linecolors["Vorraussichtl. Verbrauch"] = "#BB4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF0000";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#4444FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql_server = "localhost:3310";
|
||||
$mysql_user = "solarLog";
|
||||
$mysql_pass = "ENTFERNT_MYSQL_SOLARPASS";
|
||||
$mysql_db = "solarLog";
|
||||
$mysql = new mysqli($mysql_server, $mysql_user, $mysql_pass, $mysql_db);
|
||||
$consEst = mysqli_query($mysql, $consEstQuery);
|
||||
$prodEst = mysqli_query($mysql,$prodEstQuery);
|
||||
$prodReal = mysqli_query($mysql,$prodRealQuery);
|
||||
if(!$consEst){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
if(!$prodEst){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
if(!$prodRealQuery){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
|
||||
if($consEst->num_rows > 1){
|
||||
$row = $consEst->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."66";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = $name;
|
||||
//$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = $name;
|
||||
for($i=0;$i<7;$i++){
|
||||
$dataset->data[] = NULL;
|
||||
}
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
}
|
||||
}
|
||||
while ($row = $consEst->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($prodEst->num_rows > 1) {
|
||||
$row = $prodEst->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = $name;
|
||||
//$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = $name;
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $prodEst->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($prodReal->num_rows > 1){
|
||||
$row = $prodReal->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = $name;
|
||||
//$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = $name;
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
}
|
||||
}
|
||||
while ($row = $prodReal->fetch_assoc()) {
|
||||
$ii = 2;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consEstQuery = "SELECT
|
||||
UNIX_TIMESTAMP(DATE_ADD(datetime, INTERVAL 28 DAY)) AS 'time',
|
||||
SUM(-(totalConsumption + heaterPwr)/48) AS 'Vorraussichtl. Verbrauch'
|
||||
FROM EnergyFlow
|
||||
WHERE
|
||||
DATE(datetime) >= DATE(DATE_SUB(NOW(),INTERVAL 28 DAY)) And DATE(datetime) != DATE(NOW())
|
||||
GROUP BY WEEKDAY(datetime)
|
||||
ORDER BY datetime";
|
||||
|
||||
$prodEstQuery = "SELECT UNIX_TIMESTAMP(CONVERT_TZ(period_End,'GMT','Europe/Berlin')) AS 'time',
|
||||
SUM(power*500) AS 'Vorhersage'
|
||||
FROM simPower
|
||||
WHERE DATE(CONVERT_TZ(period_End,'GMT','Europe/Berlin')) >= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY))
|
||||
GROUP BY DAY(CONVERT_TZ(period_End,'GMT','Europe/Berlin'))
|
||||
ORDER BY period_End;";
|
||||
|
||||
$prodRealQuery = "SELECT
|
||||
UNIX_TIMESTAMP(datetime) AS 'time',
|
||||
SUM(pvP/12) AS 'Tatsächliche Erzeugung',
|
||||
SUM(-totalConsumption/12) AS 'Tatsächlicher Verbrauch'
|
||||
FROM EnergyFlow
|
||||
WHERE
|
||||
DATE(datetime) >= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY))
|
||||
GROUP BY DAY(datetime)
|
||||
ORDER BY datetime";
|
||||
|
||||
|
||||
$linecolors["Tatsächliche Erzeugung"] = "#cccc00";
|
||||
$linecolors["Tatsächlicher Verbrauch"] = "#EE9900";
|
||||
$linecolors["Vorraussichtl. Verbrauch"] = "#BB4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF0000";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#4444FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql_server = "localhost:3310";
|
||||
$mysql_user = "solarLog";
|
||||
$mysql_pass = "ENTFERNT_MYSQL_SOLARPASS";
|
||||
$mysql_db = "solarLog";
|
||||
$mysql = new mysqli($mysql_server, $mysql_user, $mysql_pass, $mysql_db);
|
||||
$consEst = mysqli_query($mysql, $consEstQuery);
|
||||
$prodEst = mysqli_query($mysql,$prodEstQuery);
|
||||
$prodReal = mysqli_query($mysql,$prodRealQuery);
|
||||
if(!$consEst){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
if(!$prodEst){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
if(!$prodRealQuery){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
|
||||
if($consEst->num_rows > 1){
|
||||
$row = $consEst->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."66";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = $name;
|
||||
//$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = $name;
|
||||
for($i=0;$i<7;$i++){
|
||||
$dataset->data[] = NULL;
|
||||
}
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
}
|
||||
}
|
||||
while ($row = $consEst->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($prodEst->num_rows > 1) {
|
||||
$row = $prodEst->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = $name;
|
||||
//$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = $name;
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $prodEst->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($prodReal->num_rows > 1){
|
||||
$row = $prodReal->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = $name;
|
||||
//$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = $name;
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
}
|
||||
}
|
||||
while ($row = $prodReal->fetch_assoc()) {
|
||||
$ii = 2;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+105
-105
@@ -1,105 +1,105 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$heatQuery = "SELECT
|
||||
UNIX_TIMESTAMP(Heater.datetime) AS time,
|
||||
PufferU AS 'Speicher unten',
|
||||
PufferM AS 'Speicher mitte',
|
||||
PufferO AS 'Speicher oben',
|
||||
|
||||
|
||||
thermeVLfb AS 'Therme Vorlauf Fußboden',
|
||||
thermeRL AS 'Therme Rücklauf',
|
||||
heaterVL AS 'Heizstab Vorlauf',
|
||||
heaterRL AS 'Heizstab Rücklauf',
|
||||
fbVL AS 'Fußboden Vorlauf',
|
||||
fbRL AS 'Fußboden Rücklauf'
|
||||
FROM Heater
|
||||
WHERE Heater.datetime BETWEEN DATE_SUB(NOW(),INTERVAL 24 HOUR) and NOW()
|
||||
ORDER BY Heater.datetime";
|
||||
|
||||
$waterQuery = "SELECT UNIX_TIMESTAMP(wasser.datetime) AS time, rate AS 'Wasserverbrauch'
|
||||
FROM solarLog.wasser
|
||||
WHERE wasser.datetime BETWEEN DATE_SUB(NOW(),INTERVAL 24 HOUR) and NOW()
|
||||
ORDER BY wasser.datetime";
|
||||
|
||||
$linecolors["Speicher oben"] = "#FF5500";
|
||||
$linecolors["Speicher mitte"] = "#FFaa00";
|
||||
$linecolors["Speicher unten"] = "#FFFF00";
|
||||
$linecolors["Therme Vorlauf Fußboden"] = "#bb0000";
|
||||
$linecolors["Therme Rücklauf"] = "#ee0000";
|
||||
$linecolors["Heizstab Vorlauf"] = "#9900bb";
|
||||
$linecolors["Heizstab Rücklauf"] = "#8800aa";
|
||||
$linecolors["Fußboden Vorlauf"] = "#00FF00";
|
||||
$linecolors["Fußboden Rücklauf"] = "#00aa00";
|
||||
$linecolors["Wasserverbrauch"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $heatQuery);
|
||||
$simRes = mysqli_query($mysql,$waterQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."22";
|
||||
$dataset->borderWidth=2;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if(strpos($name,"Speicher") === false) {
|
||||
$dataset->fill = "none";
|
||||
} else {
|
||||
// $dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$heatQuery = "SELECT
|
||||
UNIX_TIMESTAMP(Heater.datetime) AS time,
|
||||
PufferU AS 'Speicher unten',
|
||||
PufferM AS 'Speicher mitte',
|
||||
PufferO AS 'Speicher oben',
|
||||
|
||||
|
||||
thermeVLfb AS 'Therme Vorlauf Fußboden',
|
||||
thermeRL AS 'Therme Rücklauf',
|
||||
heaterVL AS 'Heizstab Vorlauf',
|
||||
heaterRL AS 'Heizstab Rücklauf',
|
||||
fbVL AS 'Fußboden Vorlauf',
|
||||
fbRL AS 'Fußboden Rücklauf'
|
||||
FROM Heater
|
||||
WHERE Heater.datetime BETWEEN DATE_SUB(NOW(),INTERVAL 24 HOUR) and NOW()
|
||||
ORDER BY Heater.datetime";
|
||||
|
||||
$waterQuery = "SELECT UNIX_TIMESTAMP(wasser.datetime) AS time, rate AS 'Wasserverbrauch'
|
||||
FROM solarLog.wasser
|
||||
WHERE wasser.datetime BETWEEN DATE_SUB(NOW(),INTERVAL 24 HOUR) and NOW()
|
||||
ORDER BY wasser.datetime";
|
||||
|
||||
$linecolors["Speicher oben"] = "#FF5500";
|
||||
$linecolors["Speicher mitte"] = "#FFaa00";
|
||||
$linecolors["Speicher unten"] = "#FFFF00";
|
||||
$linecolors["Therme Vorlauf Fußboden"] = "#bb0000";
|
||||
$linecolors["Therme Rücklauf"] = "#ee0000";
|
||||
$linecolors["Heizstab Vorlauf"] = "#9900bb";
|
||||
$linecolors["Heizstab Rücklauf"] = "#8800aa";
|
||||
$linecolors["Fußboden Vorlauf"] = "#00FF00";
|
||||
$linecolors["Fußboden Rücklauf"] = "#00aa00";
|
||||
$linecolors["Wasserverbrauch"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $heatQuery);
|
||||
$simRes = mysqli_query($mysql,$waterQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."22";
|
||||
$dataset->borderWidth=2;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if(strpos($name,"Speicher") === false) {
|
||||
$dataset->fill = "none";
|
||||
} else {
|
||||
// $dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+164
-164
@@ -1,165 +1,165 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["TO"])){
|
||||
$_GET["TO"] = 12;
|
||||
}
|
||||
$_GET["TO"] = intval($_GET["TO"]);
|
||||
if(!isset($_GET["FROM"])){
|
||||
$_GET["FROM"] = -24;
|
||||
}
|
||||
$_GET["FROM"] = intval($_GET["FROM"]);
|
||||
$consQuery = "SELECT
|
||||
UNIX_TIMESTAMP(EnergyFlow.datetime) AS time,
|
||||
pvP AS Solarleistung,
|
||||
IF(-totalConsumption - IF(gridP>0, gridP, 0) - IF(battP>0, battP, 0) > 0, -totalConsumption - IF(gridP>0, gridP, 0) - IF(battP>0, battP, 0), 0) AS Direktverbrauch,
|
||||
IF(battP>0, battP, 0) AS Batteriebezug,
|
||||
gridPcons AS Netzbezug,
|
||||
-totalConsumption AS Verbrauch,".
|
||||
//IF(battP<0, -battP, 0) AS Batterieladung,
|
||||
"soc AS Ladestand
|
||||
FROM solarLog.EnergyFlow
|
||||
WHERE EnergyFlow.datetime BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY EnergyFlow.datetime";
|
||||
|
||||
$simQuery = "SELECT
|
||||
UNIX_TIMESTAMP(simPower.period_end) AS time,
|
||||
power*1000 AS 'Vorhersage'
|
||||
FROM solarLog.simPower
|
||||
WHERE simPower.period_end BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY simPower.period_end";
|
||||
$linecolors["Solarleistung"] = "#FFFF00";
|
||||
$linecolors["Direktverbrauch"] = "#FFcc00";
|
||||
$linecolors["Verbrauch"] = "#FFaa44";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Batterieladung"] = "#0033aa";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
$simRes = mysqli_query($mysql,$simQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($simRes->num_rows > 1) {
|
||||
$dataset = (object)[];
|
||||
$row1 = $simRes->fetch_assoc();
|
||||
$dataset->borderColor = $linecolors["Vorhersage"];
|
||||
$dataset->backgroundColor = $linecolors["Vorhersage"]."55";
|
||||
$dataset->borderWidth=1.5;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = "sim";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = "Vorhersage";
|
||||
/*$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000;
|
||||
$pt->y = $row["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
while ($row = $simRes->fetch_assoc()) {
|
||||
$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000 + 30*60*1000;
|
||||
$pt->y = $row["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
}*/
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
}
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 1;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."22";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
}else if ($name == "Verbrauch") {
|
||||
$dataset->stack = "ConsPwr";
|
||||
$dataset->fill = "1";
|
||||
$dataset->yAxisID = 'y';
|
||||
}else if ($name == "Batterieladung") {
|
||||
$dataset->stack = "ConsPwr";
|
||||
$dataset->fill = "-1";
|
||||
$dataset->backgroundColor = $linecolors[$name]."77";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
if(($value * 1000) < $nextSimTimestamp){
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}else{
|
||||
$row1 = $rownext;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$obj->labels[] = $nextSimTimestamp; //Draw future forecast
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
while($rownext = $simRes->fetch_assoc()){
|
||||
$obj->labels[] = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["TO"])){
|
||||
$_GET["TO"] = 12;
|
||||
}
|
||||
$_GET["TO"] = intval($_GET["TO"]);
|
||||
if(!isset($_GET["FROM"])){
|
||||
$_GET["FROM"] = -24;
|
||||
}
|
||||
$_GET["FROM"] = intval($_GET["FROM"]);
|
||||
$consQuery = "SELECT
|
||||
UNIX_TIMESTAMP(EnergyFlow.datetime) AS time,
|
||||
pvP AS Solarleistung,
|
||||
IF(-totalConsumption - IF(gridP>0, gridP, 0) - IF(battP>0, battP, 0) > 0, -totalConsumption - IF(gridP>0, gridP, 0) - IF(battP>0, battP, 0), 0) AS Direktverbrauch,
|
||||
IF(battP>0, battP, 0) AS Batteriebezug,
|
||||
gridPcons AS Netzbezug,
|
||||
-totalConsumption AS Verbrauch,".
|
||||
//IF(battP<0, -battP, 0) AS Batterieladung,
|
||||
"soc AS Ladestand
|
||||
FROM solarLog.EnergyFlow
|
||||
WHERE EnergyFlow.datetime BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY EnergyFlow.datetime";
|
||||
|
||||
$simQuery = "SELECT
|
||||
UNIX_TIMESTAMP(simPower.period_end) AS time,
|
||||
power*1000 AS 'Vorhersage'
|
||||
FROM solarLog.simPower
|
||||
WHERE simPower.period_end BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"])." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY simPower.period_end";
|
||||
$linecolors["Solarleistung"] = "#FFFF00";
|
||||
$linecolors["Direktverbrauch"] = "#FFcc00";
|
||||
$linecolors["Verbrauch"] = "#FFaa44";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Netzbezug"] = "#FF0000";
|
||||
$linecolors["Batteriebezug"] = "#00aa00";
|
||||
$linecolors["Batterieladung"] = "#0033aa";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
$simRes = mysqli_query($mysql,$simQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($simRes->num_rows > 1) {
|
||||
$dataset = (object)[];
|
||||
$row1 = $simRes->fetch_assoc();
|
||||
$dataset->borderColor = $linecolors["Vorhersage"];
|
||||
$dataset->backgroundColor = $linecolors["Vorhersage"]."55";
|
||||
$dataset->borderWidth=1.5;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->stack = "sim";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
$dataset->label = "Vorhersage";
|
||||
/*$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000;
|
||||
$pt->y = $row["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
while ($row = $simRes->fetch_assoc()) {
|
||||
$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000 + 30*60*1000;
|
||||
$pt->y = $row["Vorhersage"];
|
||||
$dataset->data[] = clone $pt;
|
||||
}*/
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
}
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 1;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."22";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
}else if ($name == "Verbrauch") {
|
||||
$dataset->stack = "ConsPwr";
|
||||
$dataset->fill = "1";
|
||||
$dataset->yAxisID = 'y';
|
||||
}else if ($name == "Batterieladung") {
|
||||
$dataset->stack = "ConsPwr";
|
||||
$dataset->fill = "-1";
|
||||
$dataset->backgroundColor = $linecolors[$name]."77";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
if(($value * 1000) < $nextSimTimestamp){
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}else{
|
||||
$row1 = $rownext;
|
||||
$rownext = $simRes->fetch_assoc();
|
||||
$nextSimTimestamp = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $row1["Vorhersage"];
|
||||
}
|
||||
$obj->labels[] = $value * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$obj->labels[] = $nextSimTimestamp; //Draw future forecast
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
while($rownext = $simRes->fetch_assoc()){
|
||||
$obj->labels[] = $rownext["time"]*1000 + 30*60*1000;
|
||||
$obj->datasets[0]->data[] = $rownext["Vorhersage"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
?>
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime,'%Y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0) - heaterPwr/12) Direktverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP < 0, -battP/12,0)) AS Batterieladung,
|
||||
SUM(gridPfeed/12) AS Einspeisung
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 10 YEAR),'%Y')
|
||||
GROUP BY DATE_FORMAT(datetime, '%Y')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Direktverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime,'%Y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0) - heaterPwr/12) Direktverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP < 0, -battP/12,0)) AS Batterieladung,
|
||||
SUM(gridPfeed/12) AS Einspeisung
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 10 YEAR),'%Y')
|
||||
GROUP BY DATE_FORMAT(datetime, '%Y')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Direktverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime, '%d.%b.') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0) - heaterPwr/12) Direktverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP < 0, -battP/12,0)) AS Batterieladung,
|
||||
SUM(gridPfeed/12) AS Einspeisung
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m%d') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 MONTH),'%Y%m%d')
|
||||
GROUP BY DATE_FORMAT(datetime, '%d.%b.')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Direktverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime, '%d.%b.') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0) - heaterPwr/12) Direktverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP < 0, -battP/12,0)) AS Batterieladung,
|
||||
SUM(gridPfeed/12) AS Einspeisung
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m%d') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 MONTH),'%Y%m%d')
|
||||
GROUP BY DATE_FORMAT(datetime, '%d.%b.')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Direktverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+98
-98
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime,'%b. %y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0) - heaterPwr/12) Direktverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP < 0, -battP/12,0)) AS Batterieladung,
|
||||
SUM(gridPfeed/12) AS Einspeisung
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 13 MONTH),'%Y%m')
|
||||
GROUP BY DATE_FORMAT(datetime, '%b. %y')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Direktverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$consQuery = "SELECT
|
||||
DATE_FORMAT(datetime,'%b. %y') AS 'time',
|
||||
SUM(pvP/12 - IF(gridP < 0, -gridP/12,0) - IF(battP < 0, -battP/12,0) - heaterPwr/12) Direktverbrauch,
|
||||
SUM(heaterPwr/12) AS Heizstab,
|
||||
SUM(IF(battP < 0, -battP/12,0)) AS Batterieladung,
|
||||
SUM(gridPfeed/12) AS Einspeisung
|
||||
FROM EnergyFlow
|
||||
WHERE DATE_FORMAT(datetime,'%Y%m') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 13 MONTH),'%Y%m')
|
||||
GROUP BY DATE_FORMAT(datetime, '%b. %y')
|
||||
ORDER BY datetime ; ";
|
||||
|
||||
$linecolors["Direktverbrauch"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF6600";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#FF0000";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $consQuery);
|
||||
if(!$result){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($result->num_rows > 1) {
|
||||
$ii = 0;
|
||||
$row = $result->fetch_assoc();
|
||||
foreach ($row as $name => $value) {
|
||||
$dataset = (object)[];
|
||||
if ($name != "time") {
|
||||
$dataset->borderColor = $linecolors[$name];
|
||||
$dataset->backgroundColor = $linecolors[$name]."55";
|
||||
$dataset->borderWidth=1;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
if ($name == "Solarleistung") {
|
||||
$dataset->stack = "SolarPwr";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y';
|
||||
} else if ($name == "Ladestand") {
|
||||
$dataset->stack = "Charge";
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
} else {
|
||||
$dataset->stack = "Consumers";
|
||||
if ($filled == 0) {
|
||||
$filled = 1;
|
||||
$dataset->fill = "origin";
|
||||
} else {
|
||||
$dataset->fill = "-1";
|
||||
}
|
||||
$dataset->yAxisID = 'y';
|
||||
}
|
||||
$dataset->label = $name;
|
||||
|
||||
$dataset->data[] = $value;
|
||||
$obj->datasets[] = clone $dataset;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if ($name != "time") {
|
||||
$obj->datasets[$ii]->data[] = $value;
|
||||
$ii++;
|
||||
} else {
|
||||
$obj->labels[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+155
-155
@@ -1,155 +1,155 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["year"])){
|
||||
$_GET["year"] = date("Y");
|
||||
}else{
|
||||
$_GET["year"] = intval($_GET["year"]);
|
||||
}
|
||||
if($_GET["year"] < 2018 || $_GET["year"] > date("Y")){
|
||||
exit;
|
||||
}
|
||||
if(isset($_GET["type"])){
|
||||
if(strtolower($_GET["type"]) =="lastyear"){
|
||||
$_GET["year"] = date("Y")-1;
|
||||
}elseif(strtolower($_GET["type"]) =="prelastyear"){
|
||||
$_GET["year"] = date("Y")-2;
|
||||
}
|
||||
}
|
||||
|
||||
$Query = "SELECT
|
||||
SUM(gridPcons/12000) as 'Stromverbrauch',
|
||||
SUM((gridPcons*cost)/12000)+140 as 'Stromkosten (140€ fix)',
|
||||
SUM(pvP - IF(gridP < 0, -gridP,0) - IF(battP < 0, -battP,0)- heaterPwr + IF(battP > 0, battP,0))*cost/12000 as 'Verbrauchsersparnis',
|
||||
SUM((gridPfeed*gain)/12000) as 'Einspeisevergütung',
|
||||
SUM(IF(gridP < 500, heaterPwr, 0)*0.063/12000) as 'Ersparnis Heizung',
|
||||
SUM(IF(battP > 0, battP, 0)*cost/12000) as 'Ersparnis Batterie',
|
||||
AVG(autonomy) AS 'Ø Autarkie',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/12 AS 'Autoladung ges. EG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EV+PL2_EV+PL3_EV)))/(SUM(PL1_EV+PL2_EV+PL3_EV))))*100 AS 'Autoladung Solar EG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EV+PL2_EV+PL3_EV)*cost))/12) AS 'Ersparnis Solarladung EG',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/24.5 AS 'Benzin gespart EG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/12 AS 'Autoladung ges. OG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EVog+PL2_EVog+PL3_EVog)))/(SUM(PL1_EVog+PL2_EVog+PL3_EVog))))*100 AS 'Autoladung Solar OG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EVog+PL2_EVog+PL3_EVog)*cost))/12) AS 'Ersparnis Solarladung OG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/24.5 AS 'Benzin gespart OG'
|
||||
FROM EnergyFlow JOIN gridCosts ON DATE(datetime) >= DATE(gridCosts.active_date) AND DATE(datetime) <= DATE(gridCosts.end_date)
|
||||
WHERE year(datetime) = ".$_GET["year"].";";
|
||||
|
||||
$PrevQuery = "SELECT
|
||||
SUM(gridPcons/12000) as 'Stromverbrauch',
|
||||
SUM((gridPcons*cost)/12000)+140 as 'Stromkosten (140€ fix)',
|
||||
SUM(pvP - IF(gridP < 0, -gridP,0) - IF(battP < 0, -battP,0)- heaterPwr + IF(battP > 0, battP,0))*cost/12000 as 'Verbrauchsersparnis',
|
||||
SUM((gridPfeed*gain)/12000) as 'Einspeisevergütung',
|
||||
SUM(IF(gridP < 500, heaterPwr, 0)*0.063/12000) as 'Ersparnis Heizung',
|
||||
SUM(IF(battP > 0, battP, 0)*cost/12000) as 'Ersparnis Batterie',
|
||||
AVG(autonomy) AS 'Ø Autarkie',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/12 AS 'Autoladung ges. EG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EV+PL2_EV+PL3_EV)))/(SUM(PL1_EV+PL2_EV+PL3_EV))))*100 AS 'Autoladung Solar EG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EV+PL2_EV+PL3_EV)*cost))/12) AS 'Ersparnis Solarladung EG',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/24.5 AS 'Benzin gespart EG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/12 AS 'Autoladung ges. OG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EVog+PL2_EVog+PL3_EVog)))/(SUM(PL1_EVog+PL2_EVog+PL3_EVog))))*100 AS 'Autoladung Solar OG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EVog+PL2_EVog+PL3_EVog)*cost))/12) AS 'Ersparnis Solarladung OG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/24.5 AS 'Benzin gespart OG'
|
||||
FROM EnergyFlow JOIN gridCosts ON DATE(datetime) >= DATE(gridCosts.active_date) AND DATE(datetime) <= DATE(gridCosts.end_date)
|
||||
WHERE year(datetime) = ".($_GET["year"]-1).";";
|
||||
|
||||
|
||||
$units = Array("kWh","€","€","€","€","€","€","%","kWh","%","€","L","kWh","%","€","L");
|
||||
$LessIsBetter = Array(true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
|
||||
|
||||
function array_insert($array,$values,$offset) {
|
||||
return array_slice($array, 0, $offset, true) + $values + array_slice($array, $offset, NULL, true);
|
||||
}
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
|
||||
$html = "<div class='row row-info'>";
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$Res = mysqli_query($mysql,$Query);
|
||||
$ResPrev = mysqli_query($mysql,$PrevQuery);
|
||||
if(!$Res || !$ResPrev){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
if ($Res->num_rows > 0) {
|
||||
$i = 0;
|
||||
$row = $Res->fetch_assoc();
|
||||
$rowPrev = $ResPrev->fetch_assoc();
|
||||
//$row["Vergütung+Einsparung Strom"] = $row["Einspeisevergütung"]+$row["Verbrauchsersparnis"];
|
||||
$row = array_insert($row,["Verg.+Einsp. Strom" => $row["Einspeisevergütung"]+$row["Verbrauchsersparnis"]],4);
|
||||
$rowPrev = array_insert($rowPrev,["Verg.+Einsp. Strom" => $rowPrev["Einspeisevergütung"]+$rowPrev["Verbrauchsersparnis"]],4);
|
||||
$i = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if(str_starts_with($name,"Autoladung ges.")){
|
||||
$html .= "</div><hr class='mt-2 mb-3 border-light' />";
|
||||
$html .= "<div class='row row-info'>";
|
||||
}
|
||||
/*$html .= "<div class='col-12 col-sm-4 col-md-2 col-xl-1'>
|
||||
<div class='info-box'>
|
||||
<div class='info-box-content'>
|
||||
<span class='info-box-text'>".$name."</span>
|
||||
<span class='info-box-number'>".
|
||||
number_format(floatval($value),2,",",".")
|
||||
."<small>".$units[$i++]."</small>
|
||||
</span>
|
||||
</div>
|
||||
<!-- /.info-box-content -->
|
||||
</div>
|
||||
</div>";*/
|
||||
$html .= "<div class='col'>
|
||||
<div class='card stats border-0'>
|
||||
<div class='card-body bg-dark bg-gradient rounded-top pb-1 pt-1'>
|
||||
".$name."
|
||||
</div>
|
||||
<div class='card-footer text-center'>";
|
||||
if($_GET["year"] != date("Y")){
|
||||
if($LessIsBetter[$i]){
|
||||
if($value == 0)
|
||||
$dev=100;
|
||||
else
|
||||
$dev = $rowPrev[$name]/$value;
|
||||
//$first = round($rowPrev[$name]*10/$rowPrev[$name]); //allow for 10% deviation for displaying no tendency
|
||||
//$second = round($value); //allow for 10% deviation for displaying no tendency
|
||||
$arrowGood = "down";
|
||||
$arrowBad = "up";
|
||||
}else{
|
||||
if($rowPrev[$name] == 0)
|
||||
$dev=100;
|
||||
else
|
||||
$dev = $value/$rowPrev[$name];
|
||||
//$first = round($value); //allow for 10% deviation for displaying no tendency
|
||||
//$second = round($rowPrev[$name]); //allow for 10% deviation for displaying no tendency
|
||||
$arrowGood = "up";
|
||||
$arrowBad = "down";
|
||||
}
|
||||
if($dev > 1.05){
|
||||
$html .= "<span class='float-right text-success-emphasis'>
|
||||
<i class='bi bi-arrow-".$arrowGood."' style='font-size: 0.9em;'></i> ";
|
||||
}elseif($dev < 0.95){
|
||||
$html .= "<span class='float-right text-danger-emphasis'>
|
||||
<i class='bi bi-arrow-".$arrowBad."' style='font-size: 0.9em;'></i> ";
|
||||
}else{
|
||||
$html .= "<span class='float-right'>
|
||||
<i class='bi bi-arrow-right' style='font-size: 0.9em;'></i> ";
|
||||
}
|
||||
}
|
||||
else{
|
||||
$html .= "<span class='float-right'>";
|
||||
}
|
||||
$html .= number_format(floatval($value),2,",",".")
|
||||
."<small> ".$units[$i]."</small></span></div>
|
||||
<!-- /.info-box-content -->
|
||||
</div>
|
||||
</div>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$html .= "</div>";
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo $html;
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["year"])){
|
||||
$_GET["year"] = date("Y");
|
||||
}else{
|
||||
$_GET["year"] = intval($_GET["year"]);
|
||||
}
|
||||
if($_GET["year"] < 2018 || $_GET["year"] > date("Y")){
|
||||
exit;
|
||||
}
|
||||
if(isset($_GET["type"])){
|
||||
if(strtolower($_GET["type"]) =="lastyear"){
|
||||
$_GET["year"] = date("Y")-1;
|
||||
}elseif(strtolower($_GET["type"]) =="prelastyear"){
|
||||
$_GET["year"] = date("Y")-2;
|
||||
}
|
||||
}
|
||||
|
||||
$Query = "SELECT
|
||||
SUM(gridPcons/12000) as 'Stromverbrauch',
|
||||
SUM((gridPcons*cost)/12000)+140 as 'Stromkosten (140€ fix)',
|
||||
SUM(pvP - IF(gridP < 0, -gridP,0) - IF(battP < 0, -battP,0)- heaterPwr + IF(battP > 0, battP,0))*cost/12000 as 'Verbrauchsersparnis',
|
||||
SUM((gridPfeed*gain)/12000) as 'Einspeisevergütung',
|
||||
SUM(IF(gridP < 500, heaterPwr, 0)*0.063/12000) as 'Ersparnis Heizung',
|
||||
SUM(IF(battP > 0, battP, 0)*cost/12000) as 'Ersparnis Batterie',
|
||||
AVG(autonomy) AS 'Ø Autarkie',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/12 AS 'Autoladung ges. EG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EV+PL2_EV+PL3_EV)))/(SUM(PL1_EV+PL2_EV+PL3_EV))))*100 AS 'Autoladung Solar EG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EV+PL2_EV+PL3_EV)*cost))/12) AS 'Ersparnis Solarladung EG',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/24.5 AS 'Benzin gespart EG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/12 AS 'Autoladung ges. OG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EVog+PL2_EVog+PL3_EVog)))/(SUM(PL1_EVog+PL2_EVog+PL3_EVog))))*100 AS 'Autoladung Solar OG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EVog+PL2_EVog+PL3_EVog)*cost))/12) AS 'Ersparnis Solarladung OG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/24.5 AS 'Benzin gespart OG'
|
||||
FROM EnergyFlow JOIN gridCosts ON DATE(datetime) >= DATE(gridCosts.active_date) AND DATE(datetime) <= DATE(gridCosts.end_date)
|
||||
WHERE year(datetime) = ".$_GET["year"].";";
|
||||
|
||||
$PrevQuery = "SELECT
|
||||
SUM(gridPcons/12000) as 'Stromverbrauch',
|
||||
SUM((gridPcons*cost)/12000)+140 as 'Stromkosten (140€ fix)',
|
||||
SUM(pvP - IF(gridP < 0, -gridP,0) - IF(battP < 0, -battP,0)- heaterPwr + IF(battP > 0, battP,0))*cost/12000 as 'Verbrauchsersparnis',
|
||||
SUM((gridPfeed*gain)/12000) as 'Einspeisevergütung',
|
||||
SUM(IF(gridP < 500, heaterPwr, 0)*0.063/12000) as 'Ersparnis Heizung',
|
||||
SUM(IF(battP > 0, battP, 0)*cost/12000) as 'Ersparnis Batterie',
|
||||
AVG(autonomy) AS 'Ø Autarkie',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/12 AS 'Autoladung ges. EG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EV+PL2_EV+PL3_EV)))/(SUM(PL1_EV+PL2_EV+PL3_EV))))*100 AS 'Autoladung Solar EG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EV+PL2_EV+PL3_EV)*cost))/12) AS 'Ersparnis Solarladung EG',
|
||||
(SUM(PL1_EV+PL2_EV+PL3_EV))/24.5 AS 'Benzin gespart EG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/12 AS 'Autoladung ges. OG',
|
||||
(((SUM(IF(gridP>100,0,PL1_EVog+PL2_EVog+PL3_EVog)))/(SUM(PL1_EVog+PL2_EVog+PL3_EVog))))*100 AS 'Autoladung Solar OG',
|
||||
(SUM(IF(gridP>100,0,(PL1_EVog+PL2_EVog+PL3_EVog)*cost))/12) AS 'Ersparnis Solarladung OG',
|
||||
(SUM(PL1_EVog+PL2_EVog+PL3_EVog))/24.5 AS 'Benzin gespart OG'
|
||||
FROM EnergyFlow JOIN gridCosts ON DATE(datetime) >= DATE(gridCosts.active_date) AND DATE(datetime) <= DATE(gridCosts.end_date)
|
||||
WHERE year(datetime) = ".($_GET["year"]-1).";";
|
||||
|
||||
|
||||
$units = Array("kWh","€","€","€","€","€","€","%","kWh","%","€","L","kWh","%","€","L");
|
||||
$LessIsBetter = Array(true,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
|
||||
|
||||
function array_insert($array,$values,$offset) {
|
||||
return array_slice($array, 0, $offset, true) + $values + array_slice($array, $offset, NULL, true);
|
||||
}
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
|
||||
$html = "<div class='row row-info'>";
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$Res = mysqli_query($mysql,$Query);
|
||||
$ResPrev = mysqli_query($mysql,$PrevQuery);
|
||||
if(!$Res || !$ResPrev){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
if ($Res->num_rows > 0) {
|
||||
$i = 0;
|
||||
$row = $Res->fetch_assoc();
|
||||
$rowPrev = $ResPrev->fetch_assoc();
|
||||
//$row["Vergütung+Einsparung Strom"] = $row["Einspeisevergütung"]+$row["Verbrauchsersparnis"];
|
||||
$row = array_insert($row,["Verg.+Einsp. Strom" => $row["Einspeisevergütung"]+$row["Verbrauchsersparnis"]],4);
|
||||
$rowPrev = array_insert($rowPrev,["Verg.+Einsp. Strom" => $rowPrev["Einspeisevergütung"]+$rowPrev["Verbrauchsersparnis"]],4);
|
||||
$i = 0;
|
||||
foreach ($row as $name => $value) {
|
||||
if(str_starts_with($name,"Autoladung ges.")){
|
||||
$html .= "</div><hr class='mt-2 mb-3 border-light' />";
|
||||
$html .= "<div class='row row-info'>";
|
||||
}
|
||||
/*$html .= "<div class='col-12 col-sm-4 col-md-2 col-xl-1'>
|
||||
<div class='info-box'>
|
||||
<div class='info-box-content'>
|
||||
<span class='info-box-text'>".$name."</span>
|
||||
<span class='info-box-number'>".
|
||||
number_format(floatval($value),2,",",".")
|
||||
."<small>".$units[$i++]."</small>
|
||||
</span>
|
||||
</div>
|
||||
<!-- /.info-box-content -->
|
||||
</div>
|
||||
</div>";*/
|
||||
$html .= "<div class='col'>
|
||||
<div class='card stats border-0'>
|
||||
<div class='card-body bg-dark bg-gradient rounded-top pb-1 pt-1'>
|
||||
".$name."
|
||||
</div>
|
||||
<div class='card-footer text-center'>";
|
||||
if($_GET["year"] != date("Y")){
|
||||
if($LessIsBetter[$i]){
|
||||
if($value == 0)
|
||||
$dev=100;
|
||||
else
|
||||
$dev = $rowPrev[$name]/$value;
|
||||
//$first = round($rowPrev[$name]*10/$rowPrev[$name]); //allow for 10% deviation for displaying no tendency
|
||||
//$second = round($value); //allow for 10% deviation for displaying no tendency
|
||||
$arrowGood = "down";
|
||||
$arrowBad = "up";
|
||||
}else{
|
||||
if($rowPrev[$name] == 0)
|
||||
$dev=100;
|
||||
else
|
||||
$dev = $value/$rowPrev[$name];
|
||||
//$first = round($value); //allow for 10% deviation for displaying no tendency
|
||||
//$second = round($rowPrev[$name]); //allow for 10% deviation for displaying no tendency
|
||||
$arrowGood = "up";
|
||||
$arrowBad = "down";
|
||||
}
|
||||
if($dev > 1.05){
|
||||
$html .= "<span class='float-right text-success-emphasis'>
|
||||
<i class='bi bi-arrow-".$arrowGood."' style='font-size: 0.9em;'></i> ";
|
||||
}elseif($dev < 0.95){
|
||||
$html .= "<span class='float-right text-danger-emphasis'>
|
||||
<i class='bi bi-arrow-".$arrowBad."' style='font-size: 0.9em;'></i> ";
|
||||
}else{
|
||||
$html .= "<span class='float-right'>
|
||||
<i class='bi bi-arrow-right' style='font-size: 0.9em;'></i> ";
|
||||
}
|
||||
}
|
||||
else{
|
||||
$html .= "<span class='float-right'>";
|
||||
}
|
||||
$html .= number_format(floatval($value),2,",",".")
|
||||
."<small> ".$units[$i]."</small></span></div>
|
||||
<!-- /.info-box-content -->
|
||||
</div>
|
||||
</div>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$html .= "</div>";
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo $html;
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+65
-65
@@ -1,65 +1,65 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["TO"])){
|
||||
$_GET["TO"] = 12;
|
||||
}
|
||||
$_GET["TO"] = intval($_GET["TO"]);
|
||||
if(!isset($_GET["FROM"])){
|
||||
$_GET["FROM"] = -24;
|
||||
}
|
||||
$_GET["FROM"] = intval($_GET["FROM"]);
|
||||
|
||||
$Query = "SELECT
|
||||
UNIX_TIMESTAMP(CONCAT(date,' ',sunrise)) AS sunrise,
|
||||
UNIX_TIMESTAMP(CONCAT(date,' ',sunset)) AS sunset
|
||||
FROM solarLog.daylight
|
||||
WHERE date BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"]-24)." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY date";
|
||||
|
||||
$linecolors["Solarleistung"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF0000";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $Query);
|
||||
if (!$result) {
|
||||
echo "Error:<br>" . mysqli_error($mysql) . "<br />";
|
||||
}
|
||||
//$obj[] = (object)[]; // Cast empty array to object
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
$anno = (object)[];
|
||||
if($row["sunrise"] < (time()+$_GET["FROM"]*60*60)){
|
||||
$anno->xMin = (time()+$_GET["FROM"]*60*60)*1000;
|
||||
}else{
|
||||
$anno->xMin = $row["sunrise"]*1000;
|
||||
}
|
||||
if($row["sunset"] > (time()+$_GET["TO"]*60*60)){
|
||||
$anno->xMax = round(time()+$_GET["TO"]*60*60)*1000;
|
||||
}else{
|
||||
$anno->xMax = $row["sunset"]*1000;
|
||||
}
|
||||
$anno->borderWidth = 0;
|
||||
if($row["sunset"] > (time()+$_GET["FROM"]*60*60)){
|
||||
$obj[] = clone $anno;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
if(!isset($_GET["TO"])){
|
||||
$_GET["TO"] = 12;
|
||||
}
|
||||
$_GET["TO"] = intval($_GET["TO"]);
|
||||
if(!isset($_GET["FROM"])){
|
||||
$_GET["FROM"] = -24;
|
||||
}
|
||||
$_GET["FROM"] = intval($_GET["FROM"]);
|
||||
|
||||
$Query = "SELECT
|
||||
UNIX_TIMESTAMP(CONCAT(date,' ',sunrise)) AS sunrise,
|
||||
UNIX_TIMESTAMP(CONCAT(date,' ',sunset)) AS sunset
|
||||
FROM solarLog.daylight
|
||||
WHERE date BETWEEN DATE_ADD(NOW(),INTERVAL ".($_GET["FROM"]-24)." HOUR) and DATE_ADD(NOW(),INTERVAL ".$_GET["TO"]." HOUR)
|
||||
ORDER BY date";
|
||||
|
||||
$linecolors["Solarleistung"] = "#FFFF00";
|
||||
$linecolors["UG"] = "#FFaa00";
|
||||
$linecolors["OG"] = "#FF4400";
|
||||
$linecolors["Auto UG"] = "#00aaFF";
|
||||
$linecolors["Auto OG"] = "#0044FF";
|
||||
$linecolors["Heizstab"] = "#FF0000";
|
||||
$linecolors["Batterieladung"] = "#00aa00";
|
||||
$linecolors["Einspeisung"] = "#b0b0b0";
|
||||
$linecolors["Ladestand"] = "#00aa00";
|
||||
$linecolors["Vorhersage"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $Query);
|
||||
if (!$result) {
|
||||
echo "Error:<br>" . mysqli_error($mysql) . "<br />";
|
||||
}
|
||||
//$obj[] = (object)[]; // Cast empty array to object
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$ii = 1;
|
||||
$anno = (object)[];
|
||||
if($row["sunrise"] < (time()+$_GET["FROM"]*60*60)){
|
||||
$anno->xMin = (time()+$_GET["FROM"]*60*60)*1000;
|
||||
}else{
|
||||
$anno->xMin = $row["sunrise"]*1000;
|
||||
}
|
||||
if($row["sunset"] > (time()+$_GET["TO"]*60*60)){
|
||||
$anno->xMax = round(time()+$_GET["TO"]*60*60)*1000;
|
||||
}else{
|
||||
$anno->xMax = $row["sunset"]*1000;
|
||||
}
|
||||
$anno->borderWidth = 0;
|
||||
if($row["sunset"] > (time()+$_GET["FROM"]*60*60)){
|
||||
$obj[] = clone $anno;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+65
-65
@@ -1,65 +1,65 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$waterQuery = "SELECT UNIX_TIMESTAMP(datetime) AS time, rate AS 'Wasserverbrauch'
|
||||
FROM solarLog.wasser
|
||||
WHERE wasser.datetime BETWEEN DATE_SUB(NOW(),INTERVAL 24 HOUR) and NOW()
|
||||
ORDER BY wasser.datetime";
|
||||
|
||||
$linecolors["Speicher oben"] = "#FF5500";
|
||||
$linecolors["Speicher mitte"] = "#FFaa00";
|
||||
$linecolors["Speicher unten"] = "#FFFF00";
|
||||
$linecolors["Therme Vorlauf Fußboden"] = "#bb0000";
|
||||
$linecolors["Therme Rücklauf"] = "#ee0000";
|
||||
$linecolors["Heizstab Vorlauf"] = "#9900bb";
|
||||
$linecolors["Heizstab Rücklauf"] = "#8800aa";
|
||||
$linecolors["Fußboden Vorlauf"] = "#00FF00";
|
||||
$linecolors["Fußboden Rücklauf"] = "#00aa00";
|
||||
$linecolors["Wasserverbrauch"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$waterRes = mysqli_query($mysql,$waterQuery);
|
||||
if(!$waterRes){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($waterRes->num_rows > 1) {
|
||||
$dataset = (object)[];
|
||||
$row = $waterRes->fetch_assoc();
|
||||
$dataset->borderColor = $linecolors["Wasserverbrauch"];
|
||||
$dataset->backgroundColor = $linecolors["Wasserverbrauch"]."00";
|
||||
$dataset->borderWidth=2;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
$dataset->label = "Wasserverbrauch";
|
||||
$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000;
|
||||
$pt->y = $row["Wasserverbrauch"];
|
||||
$dataset->data[] = clone $pt;
|
||||
while ($row = $waterRes->fetch_assoc()) {
|
||||
$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000;
|
||||
$pt->y = $row["Wasserverbrauch"];
|
||||
$dataset->data[] = clone $pt;
|
||||
}
|
||||
$obj->datasets[] = clone $dataset;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
$waterQuery = "SELECT UNIX_TIMESTAMP(datetime) AS time, rate AS 'Wasserverbrauch'
|
||||
FROM solarLog.wasser
|
||||
WHERE wasser.datetime BETWEEN DATE_SUB(NOW(),INTERVAL 24 HOUR) and NOW()
|
||||
ORDER BY wasser.datetime";
|
||||
|
||||
$linecolors["Speicher oben"] = "#FF5500";
|
||||
$linecolors["Speicher mitte"] = "#FFaa00";
|
||||
$linecolors["Speicher unten"] = "#FFFF00";
|
||||
$linecolors["Therme Vorlauf Fußboden"] = "#bb0000";
|
||||
$linecolors["Therme Rücklauf"] = "#ee0000";
|
||||
$linecolors["Heizstab Vorlauf"] = "#9900bb";
|
||||
$linecolors["Heizstab Rücklauf"] = "#8800aa";
|
||||
$linecolors["Fußboden Vorlauf"] = "#00FF00";
|
||||
$linecolors["Fußboden Rücklauf"] = "#00aa00";
|
||||
$linecolors["Wasserverbrauch"] = "#2222FF";
|
||||
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$waterRes = mysqli_query($mysql,$waterQuery);
|
||||
if(!$waterRes){
|
||||
echo "Error:<br>".mysqli_error($mysql)."<br />";
|
||||
}
|
||||
$obj = (object)[]; // Cast empty array to object
|
||||
$obj->labels = [];
|
||||
$obj->datasets = [];
|
||||
$i = 0;
|
||||
$filled = 0;
|
||||
if ($waterRes->num_rows > 1) {
|
||||
$dataset = (object)[];
|
||||
$row = $waterRes->fetch_assoc();
|
||||
$dataset->borderColor = $linecolors["Wasserverbrauch"];
|
||||
$dataset->backgroundColor = $linecolors["Wasserverbrauch"]."00";
|
||||
$dataset->borderWidth=2;
|
||||
$dataset->pointRadius= 0;
|
||||
$dataset->pointHoverRadius= 5;
|
||||
$dataset->tension=0.2;
|
||||
$dataset->fill = "none";
|
||||
$dataset->yAxisID = 'y1';
|
||||
$dataset->label = "Wasserverbrauch";
|
||||
$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000;
|
||||
$pt->y = $row["Wasserverbrauch"];
|
||||
$dataset->data[] = clone $pt;
|
||||
while ($row = $waterRes->fetch_assoc()) {
|
||||
$pt = (object)[];
|
||||
$pt->x = $row["time"]*1000;
|
||||
$pt->y = $row["Wasserverbrauch"];
|
||||
$dataset->data[] = clone $pt;
|
||||
}
|
||||
$obj->datasets[] = clone $dataset;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//header('Content-Type: application/json');
|
||||
echo json_encode($obj);
|
||||
//echo '{"labels":[1761322682000,1761322782000,1761322882000,1761322982000,1761323082000,1761323182000,1761323282000],"datasets":[{"stack": "Stack 0","cubicInterpolationMode":"monotone","fill":"origin","label":"Acquisitions by year","data":[10,20,50,20,10,5,70]},{"fill": "false","stack": "Stack 1","cubicInterpolationMode": "monotone","label": "Acquisitions by year","data": [10,20,50,20,10,5,70]}]}';
|
||||
|
||||
+73
-73
@@ -1,73 +1,73 @@
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
function getSSLPage($url) {
|
||||
$curlSession = curl_init();
|
||||
curl_setopt($curlSession, CURLOPT_URL, $url);
|
||||
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
||||
$jsonData = json_decode(curl_exec($curlSession),true);
|
||||
curl_close($curlSession);
|
||||
return $jsonData;
|
||||
}
|
||||
|
||||
if (checkLogin()) {
|
||||
$close = 0;
|
||||
$hostname = "192.168.179.169";
|
||||
|
||||
|
||||
if (isset($_POST["setMode"]) || isset($_GET["setMode"])) {
|
||||
//send new value
|
||||
$_POST["setMode"] = intval($_POST["setMode"]) + intval($_GET["setMode"]);
|
||||
if($_POST["setMode"] > 0 && $_POST["setMode"] < 60){
|
||||
$pwr = $_POST["setMode"]*100;
|
||||
$headers[] = "GET /set?mode=man&pwr=".$pwr." HTTP/1.1";
|
||||
$headers[] = "Host: ".$hostname;
|
||||
$headers[] = "";
|
||||
$remote = fsockopen("tcp://".$hostname, 80, $errno, $errstr, 5);
|
||||
fwrite($remote, implode("\r\n", $headers)."\r\n");
|
||||
$file = '';
|
||||
$file .= fread($remote, 1024);
|
||||
fclose($remote);
|
||||
}elseif($_POST["setMode"] == 0){
|
||||
$headers[] = "GET /set?mode=eco&pwr=0 HTTP/1.1";
|
||||
$headers[] = "Host: ".$hostname;
|
||||
$headers[] = "";
|
||||
$remote = fsockopen("tcp://".$hostname, 80, $errno, $errstr, 5);
|
||||
fwrite($remote, implode("\r\n", $headers)."\r\n");
|
||||
$file = '';
|
||||
$file .= fread($remote, 1024);
|
||||
fclose($remote);
|
||||
}
|
||||
$close = 1;
|
||||
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<!--begin::Form-->
|
||||
<form id="heater_form">
|
||||
<div class="col-sm-11">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Leistung: </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">0</div>
|
||||
<input type="range" id="modal-slider" name="setMode" class="form-range range-color-track" min="0" max="60" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">Auto</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">6.0 kW</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
<?php
|
||||
|
||||
require_once("../helper.php");
|
||||
|
||||
function getSSLPage($url) {
|
||||
$curlSession = curl_init();
|
||||
curl_setopt($curlSession, CURLOPT_URL, $url);
|
||||
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
||||
$jsonData = json_decode(curl_exec($curlSession),true);
|
||||
curl_close($curlSession);
|
||||
return $jsonData;
|
||||
}
|
||||
|
||||
if (checkLogin()) {
|
||||
$close = 0;
|
||||
$hostname = "192.168.179.169";
|
||||
|
||||
|
||||
if (isset($_POST["setMode"]) || isset($_GET["setMode"])) {
|
||||
//send new value
|
||||
$_POST["setMode"] = intval($_POST["setMode"]) + intval($_GET["setMode"]);
|
||||
if($_POST["setMode"] > 0 && $_POST["setMode"] < 60){
|
||||
$pwr = $_POST["setMode"]*100;
|
||||
$headers[] = "GET /set?mode=man&pwr=".$pwr." HTTP/1.1";
|
||||
$headers[] = "Host: ".$hostname;
|
||||
$headers[] = "";
|
||||
$remote = fsockopen("tcp://".$hostname, 80, $errno, $errstr, 5);
|
||||
fwrite($remote, implode("\r\n", $headers)."\r\n");
|
||||
$file = '';
|
||||
$file .= fread($remote, 1024);
|
||||
fclose($remote);
|
||||
}elseif($_POST["setMode"] == 0){
|
||||
$headers[] = "GET /set?mode=eco&pwr=0 HTTP/1.1";
|
||||
$headers[] = "Host: ".$hostname;
|
||||
$headers[] = "";
|
||||
$remote = fsockopen("tcp://".$hostname, 80, $errno, $errstr, 5);
|
||||
fwrite($remote, implode("\r\n", $headers)."\r\n");
|
||||
$file = '';
|
||||
$file .= fread($remote, 1024);
|
||||
fclose($remote);
|
||||
}
|
||||
$close = 1;
|
||||
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<!--begin::Form-->
|
||||
<form id="heater_form">
|
||||
<div class="col-sm-11">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Leistung: </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">0</div>
|
||||
<input type="range" id="modal-slider" name="setMode" class="form-range range-color-track" min="0" max="60" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">Auto</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">6.0 kW</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
|
||||
+671
-671
File diff suppressed because it is too large
Load Diff
+55
-55
@@ -1,55 +1,55 @@
|
||||
<?php
|
||||
require_once("./phpMQTT.php");
|
||||
require_once("../helper.php");
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$close = 0;
|
||||
$hostname = "192.168.179.169";
|
||||
$server = 'localhost'; // change if necessary
|
||||
$port = 1883; // change if necessary
|
||||
$username = ''; // set your username
|
||||
$password = ''; // set your password
|
||||
$client_id = 'RoomtempSetter'; // make sure this is unique for connecting to sever - you could use uniqid()
|
||||
|
||||
if (isset($_POST["setTemp"]) && isset($_GET["heater"])) {
|
||||
$topic = "Raumtemp/".str_replace("_","/",$_GET["heater"])."/changeSetTemp";
|
||||
$mqtt = new Bluerhinos\phpMQTT($server, $port, $client_id);
|
||||
//send new value
|
||||
$temp = intval($_POST["setTemp"]);
|
||||
if($temp > 9 && $temp < 31){
|
||||
if ($mqtt->connect(true, NULL, $username, $password)) {
|
||||
$mqtt->publish($topic, $temp, 0, false);
|
||||
$mqtt->close();
|
||||
}
|
||||
}
|
||||
$close = 1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<!--begin::Form-->
|
||||
<form id="heater_form">
|
||||
<div class="col-sm-11">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Temperatur: </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">0</div>
|
||||
<input type="range" id="modal-slider" name="setTemp" class="form-range range-color-track" min="10" max="30" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">10 °C</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">30 °C</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
<?php
|
||||
require_once("./phpMQTT.php");
|
||||
require_once("../helper.php");
|
||||
|
||||
|
||||
if (checkLogin()) {
|
||||
$close = 0;
|
||||
$hostname = "192.168.179.169";
|
||||
$server = 'localhost'; // change if necessary
|
||||
$port = 1883; // change if necessary
|
||||
$username = ''; // set your username
|
||||
$password = ''; // set your password
|
||||
$client_id = 'RoomtempSetter'; // make sure this is unique for connecting to sever - you could use uniqid()
|
||||
|
||||
if (isset($_POST["setTemp"]) && isset($_GET["heater"])) {
|
||||
$topic = "Raumtemp/".str_replace("_","/",$_GET["heater"])."/changeSetTemp";
|
||||
$mqtt = new Bluerhinos\phpMQTT($server, $port, $client_id);
|
||||
//send new value
|
||||
$temp = intval($_POST["setTemp"]);
|
||||
if($temp > 9 && $temp < 31){
|
||||
if ($mqtt->connect(true, NULL, $username, $password)) {
|
||||
$mqtt->publish($topic, $temp, 0, false);
|
||||
$mqtt->close();
|
||||
}
|
||||
}
|
||||
$close = 1;
|
||||
}
|
||||
} else {
|
||||
$close = 1;
|
||||
}
|
||||
if (!$close) {
|
||||
echo <<<ENDE
|
||||
<style>
|
||||
input[type='range']::-webkit-slider-runnable-track {
|
||||
background: linear-gradient(to right, #00788F, #00788F), #D7D7D7;
|
||||
background-size: var(--background-size, 0%) 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<!--begin::Form-->
|
||||
<form id="heater_form">
|
||||
<div class="col-sm-11">
|
||||
<div class="form-check">
|
||||
<label class="form-label" for="addedCharge">Temperatur: </label>
|
||||
<div style="font-size: 15px;color: #297195;display: inline-block;" id="modal-slider-label">0</div>
|
||||
<input type="range" id="modal-slider" name="setTemp" class="form-range range-color-track" min="10" max="30" />
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">10 °C</span>
|
||||
<span class="max-amount f-16 font-weight-normal darkGray-color text-right mt-1">30 °C</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
ENDE;
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
if(isset($_GET["sensorID"])){
|
||||
$sensorID = intval($_GET["sensorID"]);
|
||||
$qry = "SELECT parameters FROM sensors WHERE id=".$sensorID;
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
echo $result->fetch_array()[0];
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
require_once("../helper.php");
|
||||
if(isset($_GET["sensorID"])){
|
||||
$sensorID = intval($_GET["sensorID"]);
|
||||
$qry = "SELECT parameters FROM sensors WHERE id=".$sensorID;
|
||||
$mysql = new mysqli($mysql_server, $mysql_solarUser, $mysql_solarPass, $mysql_solarDB);
|
||||
$result = mysqli_query($mysql, $qry);
|
||||
echo $result->fetch_array()[0];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
+241
-241
@@ -1,241 +1,241 @@
|
||||
<?php
|
||||
set_time_limit(60);
|
||||
ob_start();
|
||||
require_once("../restricted/tahoma_EG.php");
|
||||
//67ebd23e3a61763386d9
|
||||
function getSSLPage($url, $tahoma_token)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Bearer ".$tahoma_token));
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
$error_msg = curl_error($ch);
|
||||
//print $error_msg;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function postSSLPage($url, $body, $tahoma_token)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Bearer ".$tahoma_token));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
$error_msg = curl_error($ch);
|
||||
//print $error_msg;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function filter_devs($arr,$filter,$prefix=""){
|
||||
$ret = Array();
|
||||
$i = 0;
|
||||
foreach($arr as $key => $dev){
|
||||
$start = strpos(strtolower($dev["name"]),strtolower($filter));
|
||||
if($start !== false){
|
||||
$ret[$i]["name"] = $prefix.substr($dev["name"],strlen($filter));
|
||||
$ret[$i]["id"] = $key;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function searchForDevice($device){
|
||||
$dev = false;
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
if (strlen($device) < 3 && intval($device) >= 0 && intval($device) < sizeof($devices)) {
|
||||
$dev = $devices[intval($device)];
|
||||
} else if ($key = array_search($device, array_column($devices, "name"))) {
|
||||
$dev = $devices[$key];
|
||||
} else if ($key = array_search($device, array_column($devices, "id"))) {
|
||||
$dev = $devices[$key];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $dev;
|
||||
}
|
||||
|
||||
if ($_GET["action"] == "devlist") {
|
||||
$jalousien = array();
|
||||
$url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices';
|
||||
$ret = getSSLPage($url,$tahoma_token);
|
||||
$devices = json_decode($ret, true);
|
||||
$i = 0;
|
||||
foreach ($devices as $device) {
|
||||
if ($device["controllableName"] == "io:ExteriorVenetianBlindIOComponent") {
|
||||
$jalousien[$i]["name"] = $device["label"];
|
||||
$jalousien[$i]["id"] = $device["deviceURL"];
|
||||
$i = $i + 1;
|
||||
echo $device["label"] . "(".$device["deviceURL"].")<br />";
|
||||
}
|
||||
}
|
||||
$file = fopen('../restricted/tahoma_devices.json', 'w');
|
||||
fwrite($file, json_encode($jalousien));
|
||||
fclose($file);
|
||||
}elseif ($_GET["action"] == "pos" && isset($_GET["device"])) {
|
||||
$dev = searchForDevice($_GET["device"])["id"];
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
$jalousien = array();
|
||||
$url = $url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices/'.urlencode($dev)."/states";
|
||||
$ret = getSSLPage($url,$tahoma_token);
|
||||
$states = json_decode($ret, true);
|
||||
$out = "{";
|
||||
foreach ($states as $state){
|
||||
if ($state["name"] == "core:SlateOrientationState")
|
||||
$out .= "\"rotation\":".$state["value"].",";
|
||||
if ($state["name"] == "core:ClosureState")
|
||||
$out .= "\"position\":".$state["value"].",";
|
||||
}
|
||||
$out = substr($out,0,-1);
|
||||
$out .= "}";
|
||||
echo $out;
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
}elseif ($_GET["action"] == "moving" && isset($_GET["device"])) {
|
||||
$dev = searchForDevice($_GET["device"])["id"];
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
$jalousien = array();
|
||||
$url = $url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices/'.urlencode($dev)."/states/core:MovingState";
|
||||
$ret = getSSLPage($url,$tahoma_token);
|
||||
$moving = json_decode($ret, true);
|
||||
if($moving["value"])
|
||||
echo "true";
|
||||
else
|
||||
echo "false";
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
}elseif ($_GET["action"] == "move" && isset($_GET["pos"]) && isset($_GET["angle"]) && isset($_GET["device"])) {
|
||||
$angle = $_GET["angle"];
|
||||
$pos = $_GET["pos"];
|
||||
if ($pos < 0 || $pos > 100) {
|
||||
echo "Position out of Range";
|
||||
exit;
|
||||
}
|
||||
if ($angle < 0 || $angle > 100) {
|
||||
echo "Angle out of Range";
|
||||
exit;
|
||||
}
|
||||
$dev = searchForDevice($_GET["device"])["id"];
|
||||
if($dev == false){
|
||||
exit;
|
||||
}
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
$url = $url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices/'.urlencode($dev)."/states/core:MovingState";
|
||||
$ret = json_decode(getSSLPage($url,$tahoma_token),true);
|
||||
|
||||
$action = array();
|
||||
$action["label"] = "myAction";
|
||||
$action["actions"] = array();
|
||||
$action["actions"][0]["deviceURL"] = $dev;
|
||||
$action["actions"][0]["commands"] = array();
|
||||
if(!isset($ret["value"])){
|
||||
$ret = json_decode(getSSLPage($url,$tahoma_token),true);
|
||||
}
|
||||
|
||||
if(!isset($ret["value"]) || $ret["value"] == false){
|
||||
$url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/exec/apply';
|
||||
echo "start";
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
$action["actions"][0]["commands"][0]["name"] = "setClosureAndOrientation";
|
||||
$action["actions"][0]["commands"][0]["parameters"][0] = intval($pos);
|
||||
$action["actions"][0]["commands"][0]["parameters"][1] = intval($angle);
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token));
|
||||
if(!isset($res["execId"])){
|
||||
sleep(1);
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token)); //2nd try
|
||||
}
|
||||
}elseif($ret["value"] == true){
|
||||
$url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/exec/apply';
|
||||
echo "stop";
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
$action["actions"][0]["commands"][0]["name"] = "stop";
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token));
|
||||
if(!isset($res["execId"])){
|
||||
sleep(1);
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token)); //2nd try
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($_GET["action"] == "myactors") {
|
||||
if(isset($_GET["filter"])){
|
||||
$host = $_GET["filter"];
|
||||
$host = str_replace("-", "", strtolower($host));
|
||||
}else{
|
||||
$host = gethostbyaddr("192.168.179.32");
|
||||
$host = str_replace("-", "", strtolower(substr($host, 0, strpos($host, "."))));
|
||||
}
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
switch ($host) {
|
||||
case "tmpegbad":
|
||||
echo json_encode(filter_devs($devices, "bad "));
|
||||
break;
|
||||
case "tmpegwozi":
|
||||
echo json_encode(filter_devs($devices, "wozi "));
|
||||
break;
|
||||
case "tmpegflorian": //flori
|
||||
$ret = filter_devs($devices, "florian ","Flori ");
|
||||
$ret = array_merge($ret, filter_devs($devices, "magdalena ","Magdalena "));
|
||||
echo json_encode($ret);
|
||||
break;
|
||||
case "tmpegmagdalena":
|
||||
echo json_encode(filter_devs($devices, "magdalena "));
|
||||
break;
|
||||
case "tmpegschlafzimmer":
|
||||
echo json_encode(filter_devs($devices, "schlafzimmer "));
|
||||
break;
|
||||
default:
|
||||
$ret2=Array();
|
||||
//$ret2[0]["name"] = $host;
|
||||
//$ret2[0]["id"] = 99;
|
||||
$ret = filter_devs($devices, "");
|
||||
//$ret = array_merge($ret, $ret2);
|
||||
echo json_encode($ret);
|
||||
break;
|
||||
}
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
|
||||
|
||||
//echo postSSLPage($url,json_encode($action));
|
||||
}
|
||||
<?php
|
||||
set_time_limit(60);
|
||||
ob_start();
|
||||
require_once("../restricted/tahoma_EG.php");
|
||||
//67ebd23e3a61763386d9
|
||||
function getSSLPage($url, $tahoma_token)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Bearer ".$tahoma_token));
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
$error_msg = curl_error($ch);
|
||||
//print $error_msg;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
function postSSLPage($url, $body, $tahoma_token)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Bearer ".$tahoma_token));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
$error_msg = curl_error($ch);
|
||||
//print $error_msg;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function filter_devs($arr,$filter,$prefix=""){
|
||||
$ret = Array();
|
||||
$i = 0;
|
||||
foreach($arr as $key => $dev){
|
||||
$start = strpos(strtolower($dev["name"]),strtolower($filter));
|
||||
if($start !== false){
|
||||
$ret[$i]["name"] = $prefix.substr($dev["name"],strlen($filter));
|
||||
$ret[$i]["id"] = $key;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function searchForDevice($device){
|
||||
$dev = false;
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
if (strlen($device) < 3 && intval($device) >= 0 && intval($device) < sizeof($devices)) {
|
||||
$dev = $devices[intval($device)];
|
||||
} else if ($key = array_search($device, array_column($devices, "name"))) {
|
||||
$dev = $devices[$key];
|
||||
} else if ($key = array_search($device, array_column($devices, "id"))) {
|
||||
$dev = $devices[$key];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $dev;
|
||||
}
|
||||
|
||||
if ($_GET["action"] == "devlist") {
|
||||
$jalousien = array();
|
||||
$url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices';
|
||||
$ret = getSSLPage($url,$tahoma_token);
|
||||
$devices = json_decode($ret, true);
|
||||
$i = 0;
|
||||
foreach ($devices as $device) {
|
||||
if ($device["controllableName"] == "io:ExteriorVenetianBlindIOComponent") {
|
||||
$jalousien[$i]["name"] = $device["label"];
|
||||
$jalousien[$i]["id"] = $device["deviceURL"];
|
||||
$i = $i + 1;
|
||||
echo $device["label"] . "(".$device["deviceURL"].")<br />";
|
||||
}
|
||||
}
|
||||
$file = fopen('../restricted/tahoma_devices.json', 'w');
|
||||
fwrite($file, json_encode($jalousien));
|
||||
fclose($file);
|
||||
}elseif ($_GET["action"] == "pos" && isset($_GET["device"])) {
|
||||
$dev = searchForDevice($_GET["device"])["id"];
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
$jalousien = array();
|
||||
$url = $url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices/'.urlencode($dev)."/states";
|
||||
$ret = getSSLPage($url,$tahoma_token);
|
||||
$states = json_decode($ret, true);
|
||||
$out = "{";
|
||||
foreach ($states as $state){
|
||||
if ($state["name"] == "core:SlateOrientationState")
|
||||
$out .= "\"rotation\":".$state["value"].",";
|
||||
if ($state["name"] == "core:ClosureState")
|
||||
$out .= "\"position\":".$state["value"].",";
|
||||
}
|
||||
$out = substr($out,0,-1);
|
||||
$out .= "}";
|
||||
echo $out;
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
}elseif ($_GET["action"] == "moving" && isset($_GET["device"])) {
|
||||
$dev = searchForDevice($_GET["device"])["id"];
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
$jalousien = array();
|
||||
$url = $url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices/'.urlencode($dev)."/states/core:MovingState";
|
||||
$ret = getSSLPage($url,$tahoma_token);
|
||||
$moving = json_decode($ret, true);
|
||||
if($moving["value"])
|
||||
echo "true";
|
||||
else
|
||||
echo "false";
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
}elseif ($_GET["action"] == "move" && isset($_GET["pos"]) && isset($_GET["angle"]) && isset($_GET["device"])) {
|
||||
$angle = $_GET["angle"];
|
||||
$pos = $_GET["pos"];
|
||||
if ($pos < 0 || $pos > 100) {
|
||||
echo "Position out of Range";
|
||||
exit;
|
||||
}
|
||||
if ($angle < 0 || $angle > 100) {
|
||||
echo "Angle out of Range";
|
||||
exit;
|
||||
}
|
||||
$dev = searchForDevice($_GET["device"])["id"];
|
||||
if($dev == false){
|
||||
exit;
|
||||
}
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
$url = $url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/setup/devices/'.urlencode($dev)."/states/core:MovingState";
|
||||
$ret = json_decode(getSSLPage($url,$tahoma_token),true);
|
||||
|
||||
$action = array();
|
||||
$action["label"] = "myAction";
|
||||
$action["actions"] = array();
|
||||
$action["actions"][0]["deviceURL"] = $dev;
|
||||
$action["actions"][0]["commands"] = array();
|
||||
if(!isset($ret["value"])){
|
||||
$ret = json_decode(getSSLPage($url,$tahoma_token),true);
|
||||
}
|
||||
|
||||
if(!isset($ret["value"]) || $ret["value"] == false){
|
||||
$url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/exec/apply';
|
||||
echo "start";
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
$action["actions"][0]["commands"][0]["name"] = "setClosureAndOrientation";
|
||||
$action["actions"][0]["commands"][0]["parameters"][0] = intval($pos);
|
||||
$action["actions"][0]["commands"][0]["parameters"][1] = intval($angle);
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token));
|
||||
if(!isset($res["execId"])){
|
||||
sleep(1);
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token)); //2nd try
|
||||
}
|
||||
}elseif($ret["value"] == true){
|
||||
$url = 'https://gateway-'.$tahoma_PIN.':8443/enduser-mobile-web/1/enduserAPI/exec/apply';
|
||||
echo "stop";
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
$action["actions"][0]["commands"][0]["name"] = "stop";
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token));
|
||||
if(!isset($res["execId"])){
|
||||
sleep(1);
|
||||
$res = json_decode(postSSLPage($url,json_encode($action),$tahoma_token)); //2nd try
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($_GET["action"] == "myactors") {
|
||||
if(isset($_GET["filter"])){
|
||||
$host = $_GET["filter"];
|
||||
$host = str_replace("-", "", strtolower($host));
|
||||
}else{
|
||||
$host = gethostbyaddr("192.168.179.32");
|
||||
$host = str_replace("-", "", strtolower(substr($host, 0, strpos($host, "."))));
|
||||
}
|
||||
$devices = json_decode(file_get_contents('../restricted/tahoma_devices.json'), true);
|
||||
switch ($host) {
|
||||
case "tmpegbad":
|
||||
echo json_encode(filter_devs($devices, "bad "));
|
||||
break;
|
||||
case "tmpegwozi":
|
||||
echo json_encode(filter_devs($devices, "wozi "));
|
||||
break;
|
||||
case "tmpegflorian": //flori
|
||||
$ret = filter_devs($devices, "florian ","Flori ");
|
||||
$ret = array_merge($ret, filter_devs($devices, "magdalena ","Magdalena "));
|
||||
echo json_encode($ret);
|
||||
break;
|
||||
case "tmpegmagdalena":
|
||||
echo json_encode(filter_devs($devices, "magdalena "));
|
||||
break;
|
||||
case "tmpegschlafzimmer":
|
||||
echo json_encode(filter_devs($devices, "schlafzimmer "));
|
||||
break;
|
||||
default:
|
||||
$ret2=Array();
|
||||
//$ret2[0]["name"] = $host;
|
||||
//$ret2[0]["id"] = 99;
|
||||
$ret = filter_devs($devices, "");
|
||||
//$ret = array_merge($ret, $ret2);
|
||||
echo json_encode($ret);
|
||||
break;
|
||||
}
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.ob_get_length());
|
||||
ob_end_flush();
|
||||
@ob_flush();
|
||||
flush();
|
||||
fastcgi_finish_request();
|
||||
|
||||
|
||||
//echo postSSLPage($url,json_encode($action));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user