no message
This commit is contained in:
@@ -51,6 +51,14 @@
|
|||||||
"name": "SDL_Leistung",
|
"name": "SDL_Leistung",
|
||||||
"caption": "SDL_Leistung",
|
"caption": "SDL_Leistung",
|
||||||
"suffix": "W"
|
"suffix": "W"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"type": "NumberSpinner",
|
||||||
|
"name": "UpdateInterval",
|
||||||
|
"caption": "Neuberechnung alle",
|
||||||
|
"suffix": "Minuten",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 1440
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-1
@@ -12,6 +12,7 @@ class Bat_EV_SDL extends IPSModule
|
|||||||
// ---- Properties (kommen aus form.json) ----
|
// ---- Properties (kommen aus form.json) ----
|
||||||
$this->RegisterPropertyString("Batteries", "[]"); // List JSON
|
$this->RegisterPropertyString("Batteries", "[]"); // List JSON
|
||||||
$this->RegisterPropertyInteger("SDL_Leistung", 0); // W
|
$this->RegisterPropertyInteger("SDL_Leistung", 0); // W
|
||||||
|
$this->RegisterPropertyInteger("UpdateInterval", 5);
|
||||||
|
|
||||||
// ---- Status / Steuerung ----
|
// ---- Status / Steuerung ----
|
||||||
$this->RegisterVariableBoolean("State", "Aktiv", "~Switch", 1);
|
$this->RegisterVariableBoolean("State", "Aktiv", "~Switch", 1);
|
||||||
@@ -30,6 +31,8 @@ class Bat_EV_SDL extends IPSModule
|
|||||||
// Optional: Voller JSON-Dump zum Debuggen/Weiterverarbeiten
|
// Optional: Voller JSON-Dump zum Debuggen/Weiterverarbeiten
|
||||||
$this->RegisterVariableString("CalcJSON", "Berechnung (JSON)", "", 99);
|
$this->RegisterVariableString("CalcJSON", "Berechnung (JSON)", "", 99);
|
||||||
|
|
||||||
|
$this->RegisterTimer("UpdateTimer",0,'GEF_Update($_IPS["TARGET"]);');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,8 +43,19 @@ class Bat_EV_SDL extends IPSModule
|
|||||||
{
|
{
|
||||||
parent::ApplyChanges();
|
parent::ApplyChanges();
|
||||||
|
|
||||||
|
$intervalMin = (int)$this->ReadPropertyInteger("UpdateInterval");
|
||||||
|
|
||||||
// Sofort nach Speichern einmal rechnen
|
if ($intervalMin > 0) {
|
||||||
|
// Minuten → Millisekunden
|
||||||
|
$this->SetTimerInterval("UpdateTimer", $intervalMin * 60 * 1000);
|
||||||
|
$this->SendDebug("ApplyChanges", "Timer aktiv: {$intervalMin} min", 0);
|
||||||
|
} else {
|
||||||
|
// Timer aus
|
||||||
|
$this->SetTimerInterval("UpdateTimer", 0);
|
||||||
|
$this->SendDebug("ApplyChanges", "Timer deaktiviert", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Direkt einmal rechnen
|
||||||
$this->Update();
|
$this->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user