Skip to content

Commit

Permalink
v1.6 patch 2
Browse files Browse the repository at this point in the history
v1.6 patch 2
  • Loading branch information
Brovning authored Feb 26, 2022
2 parents d0a12a9 + 1c6f77d commit 7ef7fae
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions e3dc/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!",
Expand Down
20 changes: 10 additions & 10 deletions libs/myFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -352,24 +352,24 @@ 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)
{
$w = isset($a['Wert']) ? $a['Wert'] : '';
$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);
Expand All @@ -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);
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 7ef7fae

Please sign in to comment.