diff --git a/Belevo_Pv_Visu_1/README.md b/Belevo_Pv_Visu_1/README.md deleted file mode 100644 index e42d64c..0000000 --- a/Belevo_Pv_Visu_1/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Belevo_Pv_Visu_1 - -Visualisierung des Eigenverbrauchs: Tages-Quoten für PV-Produktion vs. Einspeisung und -Verbrauch vs. Netz-Bezug in IP-Symcon WebFront. - -### Inhaltsverzeichnis - -1. [Funktionsumfang](#1-funktionsumfang) -2. [Voraussetzungen](#2-voraussetzungen) -3. [Software-Installation](#3-software-installation) -4. [Instanz einrichten](#4-instanz-einrichten) -5. [WebFront](#5-webfront) -6. [PHP-Befehlsreferenz](#6-php-befehlsreferenz) - ---- - -### 1. Funktionsumfang - -- Anzeige von Tages-Quoten (in %) - - **Produktion** → Eigenverbrauch vs. Einspeisung - - **Verbrauch** → PV-Anteil vs. Netz-Anteil -- Zwei untereinander angeordnete Balkendiagramme -- Absolute Tages-Summen (kWh) in Beschriftung -- Live-Update beim Laden der Tile - ---- - -### 2. Voraussetzungen - -- IP-Symcon **ab Version 7.1** -- Aktiviertes **Archiv-Modul** -- Vier Zähler-Variablen (kWh-Profile) für Produktion, Verbrauch, Einspeisung und Netz-Bezug - ---- - -### 3. Software-Installation - -1. **Module Store** - - In der IPS-Konsole unter **Module → Modul Store** nach **Belevo_PV_Visu** suchen und installieren. -2. **Manuell per Repository** - - Unter **Module → Einstellungen → Repositories** URL hinzufügen: - ``` - https://github.com/DeinRepo/Belevo_PV_Visu.git - ``` - - Danach **Module neu einlesen**. - ---- - -### 4. Instanz einrichten - -1. **Instanz hinzufügen** → Schnellfilter **“Belevo_PV_Visu”** -2. Im Konfig-Dialog vier Variablen auswählen: - - | Property | Beschreibung | - |----------------|-------------------------------------| - | VarProduction | PV-Produktionszähler (kWh) | - | VarConsumption | Gesamtverbrauchszähler (kWh) | - | VarFeedIn | Einspeisezähler (kWh) | - | VarGrid | Netz-Bezugszähler (kWh) | - -3. Speichern – die Tile zeigt sofort die aktuellen Werte an. - ---- - -### 5. WebFront - -- **Tile-Typ:** „Belevo_PV_Visu“ -- **Oberes Balken­diagramm:** Produktion (Grün) - - Eigenverbrauch (dunkelgrün) - - Einspeisung (hellgrün) -- **Unteres Balken­diagramm:** Verbrauch (Orange/Rot) - - PV-Anteil (orange) - - Netz-Anteil (rot) - ---- - -### 6. PHP-Befehlsreferenz - -```php -// Manuelles Update der Tile anstoßen -IPS_RequestAction($InstanceID, 'update', true); diff --git a/Belevo_Pv_Visu_1/form.json b/Belevo_Pv_Visu_1/form.json deleted file mode 100644 index eeb6e7e..0000000 --- a/Belevo_Pv_Visu_1/form.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "elements": [ - { - "type": "SelectVariable", - "name": "VarProduction", - "caption": "Produktion (kWh)" - }, - { - "type": "SelectVariable", - "name": "VarConsumption", - "caption": "Verbrauch (kWh)" - }, - { - "type": "SelectVariable", - "name": "VarFeedIn", - "caption": "Einspeisung (kWh)" - }, - { - "type": "SelectVariable", - "name": "VarGrid", - "caption": "Bezug Netz (kWh)" - } - ], - "actions": [] -} diff --git a/Belevo_Pv_Visu_1/module.html b/Belevo_Pv_Visu_1/module.html deleted file mode 100644 index cb988b1..0000000 --- a/Belevo_Pv_Visu_1/module.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - -
-
-
-
-
- -
-
-
-
-
- - - - diff --git a/PV_Visu/form.json b/PV_Visu/form.json new file mode 100644 index 0000000..1acde8f --- /dev/null +++ b/PV_Visu/form.json @@ -0,0 +1,9 @@ +{ + "elements": [ + { "type": "SelectVariable", "name": "VarProduction", "caption": "Produktion (kWh)" }, + { "type": "SelectVariable", "name": "VarConsumption", "caption": "Verbrauch (kWh)" }, + { "type": "SelectVariable", "name": "VarFeedIn", "caption": "Einspeisung (kWh)" }, + { "type": "SelectVariable", "name": "VarGrid", "caption": "Bezug Netz (kWh)" } + ], + "actions": [] +} diff --git a/PV_Visu/module.html b/PV_Visu/module.html new file mode 100644 index 0000000..5d09ba6 --- /dev/null +++ b/PV_Visu/module.html @@ -0,0 +1,39 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+ + + diff --git a/Belevo_Pv_Visu_1/module.json b/PV_Visu/module.json similarity index 59% rename from Belevo_Pv_Visu_1/module.json rename to PV_Visu/module.json index efe5c0a..bf567f2 100644 --- a/Belevo_Pv_Visu_1/module.json +++ b/PV_Visu/module.json @@ -1,12 +1,12 @@ { - "id": "{84F10A55-CF98-2E63-0EAE-8C47835915C4}", - "name": "Belevo_Pv_Visu_1", + "id": "{DDE89CBE-4411-5FF4-4931-14204E05CAD0}", + "name": "PV_Visu", "type": 3, "vendor": "Belevo AG", "aliases": [], "parentRequirements": [], "childRequirements": [], "implemented": [], - "prefix": "GEF", + "prefix": "PV", "url": "" } diff --git a/Belevo_Pv_Visu_1/module.php b/PV_Visu/module.php similarity index 58% rename from Belevo_Pv_Visu_1/module.php rename to PV_Visu/module.php index c1c58f2..31190e1 100644 --- a/Belevo_Pv_Visu_1/module.php +++ b/PV_Visu/module.php @@ -1,49 +1,27 @@ -RegisterPropertyInteger('VarProduction', 0); $this->RegisterPropertyInteger('VarConsumption', 0); $this->RegisterPropertyInteger('VarFeedIn', 0); $this->RegisterPropertyInteger('VarGrid', 0); - // HTML-SDK aktivieren $this->SetVisualizationType(3); } - public function ApplyChanges() - { - parent::ApplyChanges(); - - } - /** - * Wird aufgerufen, wenn IPS das statische form.json nicht findet - * (hier leer, denn wir nutzen form.json im Root) - */ - // public function GetConfigurationForm(): string - // { - // return ''; - // } - - /** - * Liefert das HTML-Template für die WebFront-Tile - */ public function GetVisualizationTile(int $InstanceID): string { $file = __DIR__ . '/module.html'; if (!file_exists($file)) { - $this->LogMessage("module.html nicht gefunden in $file", KL_ERROR); + $this->LogMessage("module.html not found in $file", KL_ERROR); return ''; } return $this->Translate(file_get_contents($file)); } - /** - * Callback aus dem HTML: Daten neu berechnen und senden - */ public function RequestAction(string $Ident, $Value): void { if ($Ident === 'update') { @@ -53,25 +31,15 @@ class Belevo_Pv_Visu_1 extends IPSModule } } - /** - * Tägliche Summen holen, Quoten berechnen und ans Frontend senden - */ protected function UpdateData(): void { $start = strtotime('today 00:00'); $end = time(); + $prod = $this->GetDailyTotal($this->ReadPropertyInteger('VarProduction'), $start, $end); + $cons = $this->GetDailyTotal($this->ReadPropertyInteger('VarConsumption'), $start, $end); + $feed = $this->GetDailyTotal($this->ReadPropertyInteger('VarFeedIn'), $start, $end); + $grid = $this->GetDailyTotal($this->ReadPropertyInteger('VarGrid'), $start, $end); - $prodID = $this->ReadPropertyInteger('VarProduction'); - $consID = $this->ReadPropertyInteger('VarConsumption'); - $feedID = $this->ReadPropertyInteger('VarFeedIn'); - $gridID = $this->ReadPropertyInteger('VarGrid'); - - $prod = $this->GetDailyTotal($prodID, $start, $end); - $cons = $this->GetDailyTotal($consID, $start, $end); - $feed = $this->GetDailyTotal($feedID, $start, $end); - $grid = $this->GetDailyTotal($gridID, $start, $end); - - // Quoten in Prozent $prodCons = ($prod > 0) ? ($cons / $prod) * 100 : 0; $prodFeed = ($prod > 0) ? ($feed / $prod) * 100 : 0; $consPV = ($cons > 0) ? min($prod, $cons) / $cons * 100 : 0; @@ -93,26 +61,19 @@ class Belevo_Pv_Visu_1 extends IPSModule $this->UpdateVisualizationValue($data); } - /** - * Aggregierte Tageswerte aus dem Archiv - */ private function GetDailyTotal(int $varID, int $start, int $end): float { if ($varID <= 0) { return 0.0; } - // Erstes Archivmodul finden $archives = IPS_GetInstanceListByModuleID('{43192F11-5B02-4B5D-9B53-8B4DBD4769E9}'); if (empty($archives)) { return 0.0; } - $archiveID = $archives[0]; - $values = AC_GetAggregatedValues($archiveID, $varID, 1, $start, $end, 1); + $values = AC_GetAggregatedValues($archives[0], $varID, 1, $start, $end, 1); if (empty($values)) { return 0.0; } return (float)$values[0]['Avg']; } } - -?> \ No newline at end of file diff --git a/PV_Visu/readme.md b/PV_Visu/readme.md new file mode 100644 index 0000000..bc8dd0b --- /dev/null +++ b/PV_Visu/readme.md @@ -0,0 +1,59 @@ +# PV_Visu + +Visualisierung des Eigenverbrauchs: Tages-Quoten für PV-Produktion vs. Einspeisung und Verbrauch vs. Netz-Bezug. + +## Inhaltsverzeichnis + +1. [Funktionsumfang](#funktionsumfang) +2. [Voraussetzungen](#voraussetzungen) +3. [Installation](#installation) +4. [Instanz einrichten](#instanz-einrichten) +5. [WebFront](#webfront) +6. [PHP-Befehlsreferenz](#php-befehlsreferenz) + +## Funktionsumfang + +- Anzeige von Tages-Quoten (%) +- Produktion: Eigenverbrauch vs. Einspeisung +- Verbrauch: PV-Anteil vs. Netz-Anteil +- Zwei Balkendiagramme +- Absolute Tages-Summen (kWh) + +## Voraussetzungen + +- IP-Symcon ≥ 7.1 +- Archiv-Modul aktiviert +- Vier kWh-Zähler-Variablen + +## Installation + +1. **Module Store** → Suche nach „PV_Visu“ und installieren +2. **Alternativ**: Unter Module → Repositories folgende URL hinzufügen: + ``` + https://github.com/DeinRepo/PV_Visu.git + ``` + und Modul neu einlesen. + +## Instanz einrichten + +- **Instanz hinzufügen** → Filter: „PV_Visu“ +- Variablen zuweisen: + + | Property | Beschreibung | + | -------------- | -------------------------- | + | VarProduction | PV-Produktionszähler (kWh) | + | VarConsumption | Gesamtverbrauch (kWh) | + | VarFeedIn | Einspeisung (kWh) | + | VarGrid | Netz-Bezug (kWh) | + +## WebFront + +- **Tile-Typ:** PV_Visu +- Balken 1 (Grün): Produktion +- Balken 2 (Orange/Rot): Verbrauch + +## PHP-Befehlsreferenz + +```php +IPS_RequestAction($InstanceID, 'update', true); +``` diff --git a/library.json b/library.json deleted file mode 100644 index e7b8a9a..0000000 --- a/library.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "{89CAF37C-8E6E-5312-8195-6DA8AB7E5E70}", - "name": "Manager", - "author": "Daniel Haefliger", - "url": "https://git.belevo.ch/dh/Symcon_Belevo_Energiemanagement", - "compatibility": { - "version": "8.0" - }, - "version": "2.001", - "build": 0, - "date": 0 -} \ No newline at end of file