2026-02-14 20:08:34 +01:00

141 lines
5.3 KiB
PHP

<?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;
}