neuer versuch
This commit is contained in:
@@ -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 Balkendiagramm:** Produktion (Grün)
|
|
||||||
- Eigenverbrauch (dunkelgrün)
|
|
||||||
- Einspeisung (hellgrün)
|
|
||||||
- **Unteres Balkendiagramm:** Verbrauch (Orange/Rot)
|
|
||||||
- PV-Anteil (orange)
|
|
||||||
- Netz-Anteil (rot)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 6. PHP-Befehlsreferenz
|
|
||||||
|
|
||||||
```php
|
|
||||||
// Manuelles Update der Tile anstoßen
|
|
||||||
IPS_RequestAction($InstanceID, 'update', true);
|
|
||||||
@@ -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": []
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<style>
|
|
||||||
.bar-container {
|
|
||||||
width: 100%;
|
|
||||||
background: #eee;
|
|
||||||
border-radius: 4px;
|
|
||||||
overflow: hidden;
|
|
||||||
height: 18px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.bar { height: 100%; float: left; }
|
|
||||||
.bar-cons { background: #4CAF50; }
|
|
||||||
.bar-feed { background: #8BC34A; }
|
|
||||||
.bar-pv { background: #FF9800; }
|
|
||||||
.bar-grid { background: #FF5722; }
|
|
||||||
.label {
|
|
||||||
font-size: 0.9em;
|
|
||||||
margin: 4px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="label" id="prodLabel"></div>
|
|
||||||
<div class="bar-container">
|
|
||||||
<div class="bar bar-cons" id="barCons"></div>
|
|
||||||
<div class="bar bar-feed" id="barFeed"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="label" id="consLabel"></div>
|
|
||||||
<div class="bar-container">
|
|
||||||
<div class="bar bar-pv" id="barPV"></div>
|
|
||||||
<div class="bar bar-grid" id="barGrid"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function Apply(data) {
|
|
||||||
document.getElementById('prodLabel').innerText =
|
|
||||||
"Produktion: " + data.value.prod + " kWh";
|
|
||||||
document.getElementById('barCons').style.width = data.prodCons + "%";
|
|
||||||
document.getElementById('barFeed').style.width = data.prodFeed + "%";
|
|
||||||
|
|
||||||
document.getElementById('consLabel').innerText =
|
|
||||||
"Verbrauch: " + data.value.cons + " kWh";
|
|
||||||
document.getElementById('barPV').style.width = data.consPV + "%";
|
|
||||||
document.getElementById('barGrid').style.width = data.consGrid + "%";
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleMessage(msg) {
|
|
||||||
if (msg) Apply(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initial-Update anstoßen
|
|
||||||
requestAction('update', true);
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
9
PV_Visu/form.json
Normal file
9
PV_Visu/form.json
Normal file
@@ -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": []
|
||||||
|
}
|
||||||
39
PV_Visu/module.html
Normal file
39
PV_Visu/module.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
.bar-container { width:100%; background:#eee; border-radius:4px; overflow:hidden; height:18px; margin-bottom:8px; }
|
||||||
|
.bar { height:100%; float:left; }
|
||||||
|
.bar-cons { background:#4CAF50; }
|
||||||
|
.bar-feed { background:#8BC34A; }
|
||||||
|
.bar-pv { background:#FF9800; }
|
||||||
|
.bar-grid { background:#FF5722; }
|
||||||
|
.label { font-size:0.9em; margin:4px 0; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="label" id="prodLabel"></div>
|
||||||
|
<div class="bar-container">
|
||||||
|
<div class="bar bar-cons" id="barCons"></div>
|
||||||
|
<div class="bar bar-feed" id="barFeed"></div>
|
||||||
|
</div>
|
||||||
|
<div class="label" id="consLabel"></div>
|
||||||
|
<div class="bar-container">
|
||||||
|
<div class="bar bar-pv" id="barPV"></div>
|
||||||
|
<div class="bar bar-grid" id="barGrid"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function Apply(data) {
|
||||||
|
document.getElementById('prodLabel').innerText = "Produktion: " + data.value.prod + " kWh";
|
||||||
|
document.getElementById('barCons').style.width = data.prodCons + "%";
|
||||||
|
document.getElementById('barFeed').style.width = data.prodFeed + "%";
|
||||||
|
document.getElementById('consLabel').innerText = "Verbrauch: " + data.value.cons + " kWh";
|
||||||
|
document.getElementById('barPV').style.width = data.consPV + "%";
|
||||||
|
document.getElementById('barGrid').style.width = data.consGrid + "%";
|
||||||
|
}
|
||||||
|
function handleMessage(msg) { if(msg) Apply(msg); }
|
||||||
|
requestAction('update', true);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"id": "{84F10A55-CF98-2E63-0EAE-8C47835915C4}",
|
"id": "{DDE89CBE-4411-5FF4-4931-14204E05CAD0}",
|
||||||
"name": "Belevo_Pv_Visu_1",
|
"name": "PV_Visu",
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"vendor": "Belevo AG",
|
"vendor": "Belevo AG",
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"parentRequirements": [],
|
"parentRequirements": [],
|
||||||
"childRequirements": [],
|
"childRequirements": [],
|
||||||
"implemented": [],
|
"implemented": [],
|
||||||
"prefix": "GEF",
|
"prefix": "PV",
|
||||||
"url": ""
|
"url": ""
|
||||||
}
|
}
|
||||||
@@ -1,49 +1,27 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
class Belevo_Pv_Visu_1 extends IPSModule
|
class PV_Visu extends IPSModule
|
||||||
{
|
{
|
||||||
public function Create()
|
public function Create()
|
||||||
{
|
{
|
||||||
parent::Create();
|
parent::Create();
|
||||||
// Properties für die vier Zähler-Variablen
|
|
||||||
$this->RegisterPropertyInteger('VarProduction', 0);
|
$this->RegisterPropertyInteger('VarProduction', 0);
|
||||||
$this->RegisterPropertyInteger('VarConsumption', 0);
|
$this->RegisterPropertyInteger('VarConsumption', 0);
|
||||||
$this->RegisterPropertyInteger('VarFeedIn', 0);
|
$this->RegisterPropertyInteger('VarFeedIn', 0);
|
||||||
$this->RegisterPropertyInteger('VarGrid', 0);
|
$this->RegisterPropertyInteger('VarGrid', 0);
|
||||||
// HTML-SDK aktivieren
|
|
||||||
$this->SetVisualizationType(3);
|
$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
|
public function GetVisualizationTile(int $InstanceID): string
|
||||||
{
|
{
|
||||||
$file = __DIR__ . '/module.html';
|
$file = __DIR__ . '/module.html';
|
||||||
if (!file_exists($file)) {
|
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 '';
|
||||||
}
|
}
|
||||||
return $this->Translate(file_get_contents($file));
|
return $this->Translate(file_get_contents($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback aus dem HTML: Daten neu berechnen und senden
|
|
||||||
*/
|
|
||||||
public function RequestAction(string $Ident, $Value): void
|
public function RequestAction(string $Ident, $Value): void
|
||||||
{
|
{
|
||||||
if ($Ident === 'update') {
|
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
|
protected function UpdateData(): void
|
||||||
{
|
{
|
||||||
$start = strtotime('today 00:00');
|
$start = strtotime('today 00:00');
|
||||||
$end = time();
|
$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;
|
$prodCons = ($prod > 0) ? ($cons / $prod) * 100 : 0;
|
||||||
$prodFeed = ($prod > 0) ? ($feed / $prod) * 100 : 0;
|
$prodFeed = ($prod > 0) ? ($feed / $prod) * 100 : 0;
|
||||||
$consPV = ($cons > 0) ? min($prod, $cons) / $cons * 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);
|
$this->UpdateVisualizationValue($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Aggregierte Tageswerte aus dem Archiv
|
|
||||||
*/
|
|
||||||
private function GetDailyTotal(int $varID, int $start, int $end): float
|
private function GetDailyTotal(int $varID, int $start, int $end): float
|
||||||
{
|
{
|
||||||
if ($varID <= 0) {
|
if ($varID <= 0) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
// Erstes Archivmodul finden
|
|
||||||
$archives = IPS_GetInstanceListByModuleID('{43192F11-5B02-4B5D-9B53-8B4DBD4769E9}');
|
$archives = IPS_GetInstanceListByModuleID('{43192F11-5B02-4B5D-9B53-8B4DBD4769E9}');
|
||||||
if (empty($archives)) {
|
if (empty($archives)) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
$archiveID = $archives[0];
|
$values = AC_GetAggregatedValues($archives[0], $varID, 1, $start, $end, 1);
|
||||||
$values = AC_GetAggregatedValues($archiveID, $varID, 1, $start, $end, 1);
|
|
||||||
if (empty($values)) {
|
if (empty($values)) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
return (float)$values[0]['Avg'];
|
return (float)$values[0]['Avg'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
59
PV_Visu/readme.md
Normal file
59
PV_Visu/readme.md
Normal file
@@ -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);
|
||||||
|
```
|
||||||
12
library.json
12
library.json
@@ -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
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user