no message
This commit is contained in:
+24
-31
@@ -74,7 +74,7 @@ class Bat_EV_SDL_V4 extends IPSModule
|
|||||||
$this->SetBuffer("Int_LastTs", (string)microtime(true));
|
$this->SetBuffer("Int_LastTs", (string)microtime(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Update();
|
//$this->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RequestAction($Ident, $Value)
|
public function RequestAction($Ident, $Value)
|
||||||
@@ -408,6 +408,27 @@ class Bat_EV_SDL_V4 extends IPSModule
|
|||||||
$sdlTotal = (float)($plan["total"]["SDL_kWh_total"] ?? 0.0);
|
$sdlTotal = (float)($plan["total"]["SDL_kWh_total"] ?? 0.0);
|
||||||
$evTotal = (float)($plan["total"]["EV_kWh_total"] ?? 0.0);
|
$evTotal = (float)($plan["total"]["EV_kWh_total"] ?? 0.0);
|
||||||
|
|
||||||
|
if (
|
||||||
|
$this->GetBufferSafe("Int_Init") !== "1" ||
|
||||||
|
$this->GetBufferSafe("Int_E_SDL_kWh") === "" ||
|
||||||
|
$this->GetBufferSafe("Int_E_EV_kWh") === ""
|
||||||
|
) {
|
||||||
|
$sdlStartPct = max(0.0, min(100.0, (float)$this->ReadPropertyFloat("SDL_Start_Pos_Config")));
|
||||||
|
$evStartPct = max(0.0, min(100.0, (float)$this->ReadPropertyFloat("EV_Start_Pos_Config")));
|
||||||
|
|
||||||
|
$eSDL = ($sdlTotal > 0.0) ? $sdlTotal * $sdlStartPct / 100.0 : 0.0;
|
||||||
|
$eEV = ($evTotal > 0.0) ? $evTotal * $evStartPct / 100.0 : 0.0;
|
||||||
|
|
||||||
|
$this->SetBuffer("Int_E_SDL_kWh", (string)$eSDL);
|
||||||
|
$this->SetBuffer("Int_E_EV_kWh", (string)$eEV);
|
||||||
|
$this->SetBuffer("Int_LastTs", (string)$now);
|
||||||
|
$this->SetBuffer("Int_Init", "1");
|
||||||
|
|
||||||
|
$lastTs = $now;
|
||||||
|
$dtSec = 0.0;
|
||||||
|
$dtH = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
$maxSDLChargeW = (float)($plan["total"]["SDL_Charge_kW"] ?? 0.0) * 1000.0;
|
$maxSDLChargeW = (float)($plan["total"]["SDL_Charge_kW"] ?? 0.0) * 1000.0;
|
||||||
$maxSDLDisW = (float)($plan["total"]["SDL_Discharge_kW"] ?? 0.0) * 1000.0;
|
$maxSDLDisW = (float)($plan["total"]["SDL_Discharge_kW"] ?? 0.0) * 1000.0;
|
||||||
$maxEVChargeW = (float)($plan["total"]["EV_Charge_kW"] ?? 0.0) * 1000.0;
|
$maxEVChargeW = (float)($plan["total"]["EV_Charge_kW"] ?? 0.0) * 1000.0;
|
||||||
@@ -426,6 +447,8 @@ class Bat_EV_SDL_V4 extends IPSModule
|
|||||||
$eSDL = ($sdlTotal > 0.0) ? max(0.0, min($sdlTotal, $eSDL)) : 0.0;
|
$eSDL = ($sdlTotal > 0.0) ? max(0.0, min($sdlTotal, $eSDL)) : 0.0;
|
||||||
$eEV = ($evTotal > 0.0) ? max(0.0, min($evTotal, $eEV)) : 0.0;
|
$eEV = ($evTotal > 0.0) ? max(0.0, min($evTotal, $eEV)) : 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->SetBuffer("Int_E_SDL_kWh", (string)$eSDL);
|
$this->SetBuffer("Int_E_SDL_kWh", (string)$eSDL);
|
||||||
$this->SetBuffer("Int_E_EV_kWh", (string)$eEV);
|
$this->SetBuffer("Int_E_EV_kWh", (string)$eEV);
|
||||||
$this->SetBuffer("Int_LastTs", (string)$now);
|
$this->SetBuffer("Int_LastTs", (string)$now);
|
||||||
@@ -858,36 +881,6 @@ class Bat_EV_SDL_V4 extends IPSModule
|
|||||||
$this->SetIdentValue("CalcJSON", json_encode(["error" => $reason], JSON_PRETTY_PRINT));
|
$this->SetIdentValue("CalcJSON", json_encode(["error" => $reason], JSON_PRETTY_PRINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ResetVirtualAccount(string $account): void
|
|
||||||
{
|
|
||||||
$plan = json_decode($this->GetBufferSafe("BatPlanJSON"), true);
|
|
||||||
if (!is_array($plan)) {
|
|
||||||
$this->BuildBatteryPlan(true);
|
|
||||||
$plan = json_decode($this->GetBufferSafe("BatPlanJSON"), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_array($plan) || empty($plan["total"])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($account === "SDL") {
|
|
||||||
$total = (float)($plan["total"]["SDL_kWh_total"] ?? 0.0);
|
|
||||||
$startPct = 50.0;
|
|
||||||
|
|
||||||
$this->SetBuffer("Int_E_SDL_kWh", (string)($total * $startPct / 100.0));
|
|
||||||
$this->SetBuffer("Int_LastTs", (string)microtime(true));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($account === "EV") {
|
|
||||||
$total = (float)($plan["total"]["EV_kWh_total"] ?? 0.0);
|
|
||||||
$startPct = 50.0;
|
|
||||||
|
|
||||||
$this->SetBuffer("Int_E_EV_kWh", (string)($total * $startPct / 100.0));
|
|
||||||
$this->SetBuffer("Int_LastTs", (string)microtime(true));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function RoundArray($data, int $decimals = 3)
|
private function RoundArray($data, int $decimals = 3)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user