V1.0 Stable

This commit is contained in:
2025-01-22 11:12:05 +01:00
parent 7856853146
commit 05be791fde
8 changed files with 137 additions and 74 deletions

View File

@@ -29,18 +29,6 @@
"caption": "Minimum des Batterieladezustand", "caption": "Minimum des Batterieladezustand",
"suffix": "" "suffix": ""
}, },
{
"type": "SelectVariable",
"name": "Entladestrom",
"caption": "Entladestrom",
"test": true
},
{
"type": "SelectVariable",
"name": "Ladestrom",
"caption": "Ladestrom",
"test": true
},
{ {
"type": "SelectVariable", "type": "SelectVariable",
"name": "Batterieladezustand", "name": "Batterieladezustand",

View File

@@ -12,18 +12,21 @@ class Batterie extends IPSModule
$this->RegisterPropertyInteger("AufdasNachladen",0); $this->RegisterPropertyInteger("AufdasNachladen",0);
$this->RegisterPropertyInteger("MinimumEntladen",0); $this->RegisterPropertyInteger("MinimumEntladen",0);
$this->RegisterPropertyInteger("Batterieladezustand",0); $this->RegisterPropertyInteger("Batterieladezustand",0);
$this->RegisterPropertyInteger("Ladestrom", 0);
$this->RegisterPropertyInteger("Entladestrom", 0);
// Variabeln für Kommunkation mit Manager // Variabeln für Kommunkation mit Manager
$this->RegisterVariableProfile("Batterie.Leistung", 1, "W"); $this->RegisterVariableFloat("Ladestrom", "Ladestrom", "", 0);
$this->RegisterVariableProfile("Batterie.Strom", 1, "A"); $this->RegisterVariableFloat("Entladestrom", "Entladestrom", "", 0);
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "Batterie.Leistung", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableBoolean("Idle", "Idle", "", 0); $this->RegisterVariableBoolean("Idle", "Idle", "", 0);
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio"); $this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
$this->RegisterVariableInteger("PV_Prio", "PV_Prio"); $this->RegisterVariableInteger("PV_Prio", "PV_Prio");
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "Batterie.Leistung", 0); $this->RegisterVariableInteger("Power", "Power");
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterPropertyInteger("IdleCounterMax", 2);
@@ -32,6 +35,10 @@ class Batterie extends IPSModule
// Initialisiere Idle // Initialisiere Idle
$this->SetValue("Idle", true); $this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
} }
public function ApplyChanges() public function ApplyChanges()
@@ -55,35 +62,39 @@ class Batterie extends IPSModule
return $array_powersteps; return $array_powersteps;
} }
private function RegisterVariableProfile(string $name, int $type, string $suffix)
public function RequestAction($Ident, $Value)
{ {
if (!IPS_VariableProfileExists($name)) { switch ($Ident) {
IPS_CreateVariableProfile($name, $type);
IPS_SetVariableProfileText($name, "", $suffix); case "SetAktuelle_Leistung":
$this->SetValue("Power", (int)$Value);
break;
case "GetCurrentData":
$this->SetValue("Is_Peak_Shaving", (bool)$Value);
break;
case "Do_UserCalc":
$this->SetAktuelle_Leistung($this->GetValue("Power"));
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
break;
default:
throw new Exception("Invalid Ident");
} }
} }
public function RequestAction($Ident, $Value)
{
switch ($Ident) {
case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value);
break;
case "GetCurrentData":
return $this->GetCurrentData($Value);
default:
throw new Exception("Invalid Ident");
}
}
public function SetAktuelle_Leistung(int $power) public function SetAktuelle_Leistung(int $power)
{ {
$batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand"); // Als Property gelesen $batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand"); // Als Property gelesen
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung"); // Als Property gelesen $maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung"); // Als Property gelesen
$spannung = $this->ReadPropertyInteger("Batteriespannung"); // Spannung ebenfalls als Property $spannung = $this->ReadPropertyInteger("Batteriespannung"); // Spannung ebenfalls als Property
$ladestrom = $this->ReadPropertyInteger("Ladestrom"); $ladestrom = GetValue($this->GetIDForIdent("Ladestrom"));
$entladestrom = $this->ReadPropertyInteger("Entladestrom"); $entladestrom = GetValue($this->GetIDForIdent("Entladestrom"));
IPS_LogMessage("Batterie", "power: " . $power); IPS_LogMessage("Batterie", "power: " . $power);

View File

@@ -15,15 +15,15 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
$this->RegisterPropertyInteger("Kontakt_Volllast", 0); $this->RegisterPropertyInteger("Kontakt_Volllast", 0);
$this->RegisterPropertyBoolean("Boilertemperatur_glätten", false); $this->RegisterPropertyBoolean("Boilertemperatur_glätten", false);
// Boiler spezifische Variablen // Boiler spezifische Variablen
$this->RegisterVariableInteger("Mindesttemperatur","Mindesttemperatur","",45); $this->RegisterVariableInteger("Mindesttemperatur","Mindesttemperatur","",45);
$this->RegisterVariableInteger("Maximaltemperatur","Maximaltemperatur","",60); $this->RegisterVariableInteger("Maximaltemperatur","Maximaltemperatur","",60);
$this->RegisterVariableInteger("Legionellentemperatur","Legionellentemperatur","",65); $this->RegisterVariableInteger("Legionellentemperatur","Legionellentemperatur","",65);
$this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0); $this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0);
//$this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0);
$this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0); $this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0);
// Variabeln für Kommunkation mit Manager // Variabeln für Kommunkation mit Manager
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio"); $this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
@@ -32,6 +32,8 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableInteger("Power", "Power");
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterPropertyInteger("IdleCounterMax", 2);
@@ -40,30 +42,37 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
// Initialisiere Idle // Initialisiere Idle
$this->SetValue("Idle", true); $this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
} }
public function ApplyChanges() public function ApplyChanges()
{ {
parent::ApplyChanges(); parent::ApplyChanges();
} }
public function RequestAction($Ident, $Value) public function RequestAction($Ident, $Value)
{ {
switch ($Ident) { switch ($Ident) {
case "SetAktuelle_Leistung": case "SetAktuelle_Leistung":
$this->SetValue("Power", (int)$Value);
$this->SetAktuelle_Leistung($Value);
break; break;
case "GetCurrentData": case "GetCurrentData":
$this->SetValue("Is_Peak_Shaving", (bool)$Value);
$result = $this->GetCurrentData($Value); break;
return $result;
case "Do_UserCalc":
$this->SetAktuelle_Leistung($this->GetValue("Power"));
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
break;
default: default:
throw new Exception("Invalid Ident"); throw new Exception("Invalid Ident");
} }
@@ -112,35 +121,39 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
$boilertemperatur_glätten = $this->ReadPropertyBoolean("Boilertemperatur_glätten"); $boilertemperatur_glätten = $this->ReadPropertyBoolean("Boilertemperatur_glätten");
if ($boilertemperatur_glätten) { if ($boilertemperatur_glätten) {
// Wenn Glättung aktiviert ist, führe das Glätten durch
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1"); $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1");
if (IPS_VariableExists($boilerFuehlerPT1ID)) { if (IPS_VariableExists($boilerFuehlerPT1ID)) {
$boilerPT1 = GetValue($boilerFuehlerPT1ID); $boilerPT1 = GetValue($boilerFuehlerPT1ID);
} else { } else {
$boilerPT1 = 0.0; $boilerPT1 = 0.0; // Standardwert
} }
$boilerTemp_test = $this->GetIDForIdent("Boilertemperatur");
if (IPS_VariableExists($boilerTemp_test)) { $boilerTempID = $this->GetIDForIdent("Boilertemperatur");
$boilerTemp_test = $this->GetValue("Boilertemperatur"); if (IPS_VariableExists($boilerTempID)) {
$boilerTemp = $this->GetValue("Boilertemperatur");
} else { } else {
$boilerTemp_test = 0.0; $boilerTemp = 0.0; // Standardwert
} }
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
$boilerTemp_test = $this->GetValue("Boilertemperatur"); // PT
$time_constant= $this->ReadPropertyInteger("ZeitKonstante"); $time_constant= $this->ReadPropertyInteger("ZeitKonstante");
$delta_t = 30; $delta_t = 30; // Zeitdifferenz zwischen den Messungen (30 Sekunden)
$alpha = $delta_t / ($time_constant + $delta_t); $alpha = $delta_t / ($time_constant + $delta_t);
$newBoilerTemp = $boilerTemp_test + $alpha * ($boilerPT1 - $boilerTemp_test); $newBoilerTemp = $boilerTemp + $alpha * ($boilerPT1 - $boilerTemp);
$this->SetValue("Boilertemperatur", $newBoilerTemp); $this->SetValue("Boilertemperatur", $newBoilerTemp);
} else { } else {
// Wenn Glättung nicht aktiviert ist, setze die Boilertemperatur direkt auf den Wert des Boilerfühlers
$boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1"); $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1");
if (IPS_VariableExists($boilerFuehlerPT1ID)) { if (IPS_VariableExists($boilerFuehlerPT1ID)) {
$boilerPT1 = GetValue($boilerFuehlerPT1ID); $boilerPT1 = GetValue($boilerFuehlerPT1ID);
} else { } else {
$boilerPT1 = 0.0; $boilerPT1 = 0.0; // Standardwert
} }
$boilerPT1 = GetValue($boilerFuehlerPT1ID);
// Setze Boilertemperatur direkt auf den Wert des Boilerfühlers
$this->SetValue("Boilertemperatur", $boilerPT1); $this->SetValue("Boilertemperatur", $boilerPT1);
} }
@@ -172,6 +185,9 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule
if ($LegioCounter > 120960 && $this->ist_nachts()) { if ($LegioCounter > 120960 && $this->ist_nachts()) {
$minTemp = $LegioTemp; $minTemp = $LegioTemp;
} }
if ($LegioCounter > 138240) { // Timeout für Legio wenn temperatur nicht erreicht werden kann, setze legionellenfunktion zurück
$LegioCounter = 0;
}
$this->SetValue("LegioCounter", $LegioCounter); $this->SetValue("LegioCounter", $LegioCounter);

View File

@@ -36,6 +36,8 @@ class Ladestation_Universal extends IPSModule
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableInteger("Power", "Power");
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterPropertyInteger("IdleCounterMax", 2);
@@ -44,6 +46,9 @@ class Ladestation_Universal extends IPSModule
// Initialisiere Idle // Initialisiere Idle
$this->SetValue("Idle", true); $this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
} }
public function ApplyChanges() public function ApplyChanges()
@@ -52,16 +57,24 @@ class Ladestation_Universal extends IPSModule
// Zusätzliche Anpassungen nach Bedarf // Zusätzliche Anpassungen nach Bedarf
} }
// Aktionen verarbeiten
public function RequestAction($Ident, $Value) public function RequestAction($Ident, $Value)
{ {
switch ($Ident) { switch ($Ident) {
case "SetAktuelle_Leistung": case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value); $this->SetValue("Power", (int)$Value);
break; break;
case "GetCurrentData": case "GetCurrentData":
$powerSteps = $this->GetCurrentData($Value); $this->SetValue("Is_Peak_Shaving", (bool)$Value);
return $powerSteps; break;
case "Do_UserCalc":
$this->SetAktuelle_Leistung($this->GetValue("Power"));
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
break;
default: default:
throw new Exception("Invalid Ident"); throw new Exception("Invalid Ident");
} }

View File

@@ -254,6 +254,11 @@ class Manager extends IPSModule
} }
} }
} }
} }
} }
?> ?>

View File

@@ -29,6 +29,8 @@ class Verbraucher_1_Stufig extends IPSModule
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableInteger("Power", "Power");
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterPropertyInteger("IdleCounterMax", 2);
@@ -37,6 +39,9 @@ class Verbraucher_1_Stufig extends IPSModule
// Initialisiere Idle // Initialisiere Idle
$this->SetValue("Idle", true); $this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
} }
public function ApplyChanges() public function ApplyChanges()
@@ -44,24 +49,34 @@ class Verbraucher_1_Stufig extends IPSModule
parent::ApplyChanges(); parent::ApplyChanges();
} }
// Aktionen verarbeiten
public function RequestAction($Ident, $Value) public function RequestAction($Ident, $Value)
{ {
switch ($Ident) { switch ($Ident) {
case "SetAktuelle_Leistung": case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value); $this->SetValue("Power", (int)$Value);
break; break;
case "GetCurrentData": case "GetCurrentData":
return $this->GetCurrentData($Value); $this->SetValue("Is_Peak_Shaving", (bool)$Value);
break; break;
case "ResetPowerSteps": case "ResetPowerSteps":
$this->ResetPowerSteps($Value); $this->ResetPowerSteps($Value);
break; break;
case "Do_UserCalc":
$this->SetAktuelle_Leistung($this->GetValue("Power"));
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
break;
default: default:
throw new Exception("Invalid Ident"); throw new Exception("Invalid Ident");
} }
} }
// Methode zum Setzen der PowerSteps und Timer starten // Methode zum Setzen der PowerSteps und Timer starten
public function SetTimerOn() public function SetTimerOn()
{ {

View File

@@ -34,6 +34,8 @@ class WP_Steuerung extends IPSModule
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableInteger("Power", "Power");
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterPropertyInteger("IdleCounterMax", 2);
@@ -42,6 +44,9 @@ class WP_Steuerung extends IPSModule
// Initialisiere Idle // Initialisiere Idle
$this->SetValue("Idle", true); $this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
} }
public function ApplyChanges() public function ApplyChanges()
@@ -49,24 +54,34 @@ class WP_Steuerung extends IPSModule
parent::ApplyChanges(); parent::ApplyChanges();
} }
// Aktionen verarbeiten
public function RequestAction($Ident, $Value) public function RequestAction($Ident, $Value)
{ {
switch ($Ident) { switch ($Ident) {
case "SetAktuelle_Leistung": case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value); $this->SetValue("Power", (int)$Value);
break; break;
case "GetCurrentData": case "GetCurrentData":
return $this->GetCurrentData($Value); $this->SetValue("Is_Peak_Shaving", (bool)$Value);
break; break;
case "ResetPowerSteps": case "ResetPowerSteps":
$this->ResetPowerSteps($Value); $this->ResetPowerSteps($Value);
break; break;
case "Do_UserCalc":
$this->SetAktuelle_Leistung($this->GetValue("Power"));
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
break;
default: default:
throw new Exception("Invalid Ident"); throw new Exception("Invalid Ident");
} }
} }
// Methode zum Setzen des aktuellen Stromverbrauchs // Methode zum Setzen des aktuellen Stromverbrauchs
public function SetAktuelle_Leistung(float $power) public function SetAktuelle_Leistung(float $power)
{ {

View File

@@ -6,7 +6,7 @@
"compatibility": { "compatibility": {
"version": "7.1" "version": "7.1"
}, },
"version": "0.277", "version": "1.0",
"build": 0, "build": 0,
"date": 0 "date": 0