diff --git a/Bat_EV_SDL/module.php b/Bat_EV_SDL/module.php index 8ec28af..f935da2 100644 --- a/Bat_EV_SDL/module.php +++ b/Bat_EV_SDL/module.php @@ -212,16 +212,16 @@ class Bat_EV_SDL extends IPSModule } // Variablen setzen - $this->SetValueFloat("SDL_Pos", round($sdlPosPct, 3)); - $this->SetValueFloat("SoC_EV", round($evPosPct, 3)); + $this->SetIdentValue("SDL_Pos", round($sdlPosPct, 3)); + $this->SetIdentValue("SoC_EV", round($evPosPct, 3)); - $this->SetValueFloat("P_SDL_max", round($sumSdlPowerW, 2)); - $this->SetValueFloat("P_SDL_laden", round($pSdlChargeW, 2)); - $this->SetValueFloat("P_SDL_entladen", round($pSdlDischargeW, 2)); + $this->SetIdentValue("P_SDL_max", round($sumSdlPowerW, 2)); + $this->SetIdentValue("P_SDL_laden", round($pSdlChargeW, 2)); + $this->SetIdentValue("P_SDL_entladen", round($pSdlDischargeW, 2)); - $this->SetValueFloat("P_EV_max", round($sumEvPowerW, 2)); - $this->SetValueFloat("P_EV_laden", round($pEvChargeW, 2)); - $this->SetValueFloat("P_EV_entladen", round($pEvDischargeW, 2)); + $this->SetIdentValue("P_EV_max", round($sumEvPowerW, 2)); + $this->SetIdentValue("P_EV_laden", round($pEvChargeW, 2)); + $this->SetIdentValue("P_EV_entladen", round($pEvDischargeW, 2)); $calc["totals"] = [ "totalStored_kWh" => round($totalStoredKWh, 4), @@ -241,7 +241,12 @@ class Bat_EV_SDL extends IPSModule $this->SetValueString("CalcJSON", json_encode($calc, JSON_PRETTY_PRINT)); } - + private function SetIdentValue(string $ident, $value): void + { + $id = $this->GetIDForIdent($ident); + if ($id <= 0) return; + SetValue($id, $value); + } private function ReadSocPercent(int $varId): float {