From 0e9ad10626bfc9acc72e52a6beb82b2f3a4dc7cd Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Thu, 22 Jan 2026 14:40:06 +0100 Subject: [PATCH] no message --- Bat_EV_SDL/form.json | 10 +++++++++- Bat_EV_SDL/module.php | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Bat_EV_SDL/form.json b/Bat_EV_SDL/form.json index 7b856b0..baa9566 100644 --- a/Bat_EV_SDL/form.json +++ b/Bat_EV_SDL/form.json @@ -51,6 +51,14 @@ "name": "SDL_Leistung", "caption": "SDL_Leistung", "suffix": "W" - } + }, + { + "type": "NumberSpinner", + "name": "UpdateInterval", + "caption": "Neuberechnung alle", + "suffix": "Minuten", + "minimum": 0, + "maximum": 1440 + } ] } diff --git a/Bat_EV_SDL/module.php b/Bat_EV_SDL/module.php index 2cb513c..5faadde 100644 --- a/Bat_EV_SDL/module.php +++ b/Bat_EV_SDL/module.php @@ -12,6 +12,7 @@ class Bat_EV_SDL extends IPSModule // ---- Properties (kommen aus form.json) ---- $this->RegisterPropertyString("Batteries", "[]"); // List JSON $this->RegisterPropertyInteger("SDL_Leistung", 0); // W + $this->RegisterPropertyInteger("UpdateInterval", 5); // ---- Status / Steuerung ---- $this->RegisterVariableBoolean("State", "Aktiv", "~Switch", 1); @@ -30,6 +31,8 @@ class Bat_EV_SDL extends IPSModule // Optional: Voller JSON-Dump zum Debuggen/Weiterverarbeiten $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(); + $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(); }