diff --git a/README.md b/README.md index 4449ffa..af2cdb1 100644 --- a/README.md +++ b/README.md @@ -790,13 +790,14 @@ Aktiviert die Schuko-Steckdose der Wallbox $WallboxId (von 0 bis 7) der E3DC-Ins ### 8. Versionshistorie -#### v1.6 patch 1, 25.02.2022 +#### v1.6 patch 2, 26.02.2022 - Register für Wechselrichter hinzugefügt (ab SW-Version >=S10_2022_02) - Maximal nutzbare Batteriekapazität konfigurierbar (Alterung kann berücksichtigt werden) - DC-String Information einzeln aktivierbar - kW Wert zu DC-String Information hinzugefügt - Layout des Konfigurationsformulars überarbeitet - Bugfix #18: Uncaught TypeError getPowerSumOfLog() +- Bugfix #20: Uncaught TypeError: deleteInstanceNotInUse() #### v1.5, 20.01.2022 - bugfix #12: Wrong Modbus datatype used for powermeter values in W diff --git a/e3dc/module.php b/e3dc/module.php index cc7e624..85704e8 100644 --- a/e3dc/module.php +++ b/e3dc/module.php @@ -10,6 +10,7 @@ if (!defined('MODUL_PREFIX')) { define("MODUL_PREFIX", "E3DC"); + define("MODUL_ID", "{C9508720-B23D-B37A-B5C2-97B607221CE1}"); } // Offset von Register (erster Wert 1) zu Adresse (erster Wert 0) ist -1 @@ -218,7 +219,25 @@ public function Destroy() public function GetConfigurationForm() { + $libraryJson = @IPS_GetLibrary(MODUL_ID); + + $headline = MODUL_PREFIX." Modul"; + if(isset($libraryJson['Version'])) + { + $headline .= " v".$libraryJson['Version']; + } + + if(isset($libraryJson['Date']) && 0 != $libraryJson['Date']) + { + $headline .= " (".$libraryJson['Date'].")"; + } + $formElements = array(); + $formElements[] = array( + 'type' => "Label", + 'label' => $headline, + 'bold' => true, + ); $formElements[] = array( 'type' => "Label", 'label' => "Im E3DC Stromspeicher muss Modbus TCP aktiviert sein!", diff --git a/libs/myFunctions.php b/libs/myFunctions.php index 0b65263..d3ea839 100644 --- a/libs/myFunctions.php +++ b/libs/myFunctions.php @@ -172,7 +172,7 @@ private function deleteInstanceNotInUse(int $connectionId_Old, string $moduleId) // Loesche Connection-Instanz (bspw. ModbusAddress, ClientSocket,...), wenn nicht mehr in Verwendung if (!$inUse) { - $returnValue &= IPS_DeleteInstance($connectionId_Old); + $returnValue = $returnValue && IPS_DeleteInstance($connectionId_Old); } } @@ -352,16 +352,16 @@ private function createVarProfile(string $ProfilName, int $ProfileType, string $ if (!IPS_VariableProfileExists($ProfilName)) { - $returnValue &= IPS_CreateVariableProfile($ProfilName, $ProfileType); - $returnValue &= IPS_SetVariableProfileText($ProfilName, '', $Suffix); + $returnValue = $returnValue && IPS_CreateVariableProfile($ProfilName, $ProfileType); + $returnValue = $returnValue && IPS_SetVariableProfileText($ProfilName, '', $Suffix); if (in_array($ProfileType, array(VARIABLETYPE_INTEGER, VARIABLETYPE_FLOAT))) { - $returnValue &= IPS_SetVariableProfileValues($ProfilName, $MinValue, $MaxValue, $StepSize); - $returnValue &= IPS_SetVariableProfileDigits($ProfilName, $Digits); + $returnValue = $returnValue && IPS_SetVariableProfileValues($ProfilName, $MinValue, $MaxValue, $StepSize); + $returnValue = $returnValue && IPS_SetVariableProfileDigits($ProfilName, $Digits); } - $returnValue &= IPS_SetVariableProfileIcon($ProfilName, $Icon); + $returnValue = $returnValue && IPS_SetVariableProfileIcon($ProfilName, $Icon); foreach ($Associations as $a) { @@ -369,7 +369,7 @@ private function createVarProfile(string $ProfilName, int $ProfileType, string $ $n = isset($a['Name']) ? $a['Name'] : ''; $i = isset($a['Icon']) ? $a['Icon'] : ''; $f = isset($a['Farbe']) ? $a['Farbe'] : -1; - $returnValue &= IPS_SetVariableProfileAssociation($ProfilName, $w, $n, $i, $f); + $returnValue = $returnValue && IPS_SetVariableProfileAssociation($ProfilName, $w, $n, $i, $f); } $this->SendDebug("Variable-Profile", "Profile ".$ProfilName." created", 0); @@ -392,7 +392,7 @@ private function deleteModbusInstancesRecursive(array $inverterModelRegister_arr $instanceId = @IPS_GetObjectIDByIdent($register[IMR_START_REGISTER].$uniqueIdent, $categoryId); if (false !== $instanceId) { - $returnValue &= $this->deleteInstanceRecursive($instanceId); + $returnValue = $returnValue && $this->deleteInstanceRecursive($instanceId); $this->SendDebug("delete Modbus address", "REG_".$register[IMR_START_REGISTER]." - ".$register[IMR_NAME].", ID=".$instanceId, 0); } @@ -406,9 +406,9 @@ private function deleteInstanceRecursive(int $instanceId): bool $returnValue = true; foreach (IPS_GetChildrenIDs($instanceId) as $childChildId) { - $returnValue &= IPS_DeleteVariable($childChildId); + $returnValue = $returnValue && IPS_DeleteVariable($childChildId); } - $returnValue &= IPS_DeleteInstance($instanceId); + $returnValue = $returnValue && IPS_DeleteInstance($instanceId); return (bool)$returnValue; }