no message
This commit is contained in:
@@ -26,8 +26,8 @@ class Bat_EV_SDL_V2 extends IPSModule
|
|||||||
// Variablen
|
// Variablen
|
||||||
$this->RegisterVariableFloat("Nennleistung_Soll_EV", "Nennleistung Soll EV", "", 2);
|
$this->RegisterVariableFloat("Nennleistung_Soll_EV", "Nennleistung Soll EV", "", 2);
|
||||||
$this->RegisterVariableFloat("Nennleistung_Soll_SDL", "Nennleistung Soll SDL", "", 3);
|
$this->RegisterVariableFloat("Nennleistung_Soll_SDL", "Nennleistung Soll SDL", "", 3);
|
||||||
$this->RegisterVariableFloat("Aktuelle_Leistung_EV", "Aktuelle Leistung EV", "", 4);
|
$this->RegisterVariableFloat("Aktuelle_Leistung_EV", "Aktuelle Leistung EV", "", 5);
|
||||||
$this->RegisterVariableFloat("Aktuelle_Leistung_SDL", "Aktuelle Leistung SDL", "", 5);
|
$this->RegisterVariableFloat("Aktuelle_Leistung_SDL", "Aktuelle Leistung SDL", "", 4);
|
||||||
$this->RegisterVariableFloat("P_SDL_laden", "P SDL laden max (W)", "", 21);
|
$this->RegisterVariableFloat("P_SDL_laden", "P SDL laden max (W)", "", 21);
|
||||||
$this->RegisterVariableFloat("P_SDL_entladen", "P SDL entladen max (W)", "", 22);
|
$this->RegisterVariableFloat("P_SDL_entladen", "P SDL entladen max (W)", "", 22);
|
||||||
$this->RegisterVariableFloat("P_EV_laden", "P EV laden max (W)", "", 31);
|
$this->RegisterVariableFloat("P_EV_laden", "P EV laden max (W)", "", 31);
|
||||||
|
|||||||
@@ -91,11 +91,57 @@ class Batterie extends IPSModule
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->RegisterMessageWatchMaxValues();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function RegisterMessageWatchMaxValues()
|
||||||
|
{
|
||||||
|
// alte Watcher entfernen (falls sich die ausgewählten Variablen geändert haben)
|
||||||
|
$old = json_decode($this->GetBuffer("WatchMaxIDs") ?: "[]", true);
|
||||||
|
if (is_array($old)) {
|
||||||
|
foreach ($old as $oid) {
|
||||||
|
$oid = (int)$oid;
|
||||||
|
if ($oid > 0 && IPS_VariableExists($oid)) {
|
||||||
|
$this->UnregisterMessage($oid, VM_UPDATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// neue IDs aus den Properties holen (SelectVariable => Variable-ID)
|
||||||
|
$idMaxBat = (int)$this->ReadPropertyInteger("MaxBatterieleistung");
|
||||||
|
$idMaxNach = (int)$this->ReadPropertyInteger("MaxNachladen");
|
||||||
|
|
||||||
|
$new = [];
|
||||||
|
foreach ([$idMaxBat, $idMaxNach] as $id) {
|
||||||
|
if ($id > 0 && IPS_VariableExists($id)) {
|
||||||
|
$this->RegisterMessage($id, VM_UPDATE);
|
||||||
|
$new[] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->SetBuffer("WatchMaxIDs", json_encode($new));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function MessageSink($TimeStamp, $SenderID, $Message, $Data)
|
||||||
|
{
|
||||||
|
if ($Message !== VM_UPDATE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$watch = json_decode($this->GetBuffer("WatchMaxIDs") ?: "[]", true);
|
||||||
|
if (!is_array($watch)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array((int)$SenderID, array_map('intval', $watch), true)) {
|
||||||
|
// sofort neu berechnen
|
||||||
|
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function GeneratePowerSteps($additionalValue)
|
private function GeneratePowerSteps($additionalValue)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user