From 06a0e373bfba9015c89f8fdc299f59fa2291cd1c Mon Sep 17 00:00:00 2001 From: jhartworks Date: Fri, 31 Jan 2025 13:34:41 +0100 Subject: [PATCH] initial --- CounterTable/form.json | 89 +++++++++++++++++++ CounterTable/module.json | 14 +++ CounterTable/module.php | 182 +++++++++++++++++++++++++++++++++++++++ library.json | 13 +++ 4 files changed, 298 insertions(+) create mode 100644 CounterTable/form.json create mode 100644 CounterTable/module.json create mode 100644 CounterTable/module.php create mode 100644 library.json diff --git a/CounterTable/form.json b/CounterTable/form.json new file mode 100644 index 0000000..48346b9 --- /dev/null +++ b/CounterTable/form.json @@ -0,0 +1,89 @@ +{ + "elements": + [ + { "type": "NumberSpinner", "Name": "Price", "caption": "Strompreis", "digits": 2}, + { + "type": "List", + "name": "Counters", + "caption": "Zählerliste", + "add": true, + "delete": true, + "sort": { + "column": "Name", + "direction": "ascending" + }, + "columns": [{ + "caption": "InstanceID", + "name": "InstanceID", + "width": "75px", + "add": 0, + "edit": { + "type": "SelectInstance" + } + }, + { + "caption": "Name", + "name": "Name", + "width": "auto", + "add": "" + }, + { + "caption": "Gesamtverbrauch", + "name": "Total", + "width": "40px", + "edit": { + "type": "SelectVariable", + "validVariableTypes": [7] + } + }, + { + "caption": "Monatsverbrauch", + "name": "Monthly", + "width": "75px", + "edit": { + "type": "SelectVariable", + "validVariableTypes": [7] + } + }, + { + "caption": "Wochenverbrauch", + "name": "Weekly", + "width": "75px", + "edit": { + "type": "SelectVariable", + "validVariableTypes": [7] + } + }, + { + "caption": "Tagesverbrauch", + "name": "Daily", + "width": "75px", + "edit": { + "type": "SelectVariable", + "validVariableTypes": [7] + } + }, + { + "caption": "Limit", + "name": "Limit", + "width": "75px", + "edit": { + "type": "NumberSpinner", + "digits": 2 + } + } + + + ] + } + + ], + "actions": + [ + + ], + "status": + [ + + ] +} \ No newline at end of file diff --git a/CounterTable/module.json b/CounterTable/module.json new file mode 100644 index 0000000..944f6a1 --- /dev/null +++ b/CounterTable/module.json @@ -0,0 +1,14 @@ +{ + "id": "{D0DA85AB-1BAD-C36C-A3FD-1C2660F96F1C}", + "name": "CounterTable", + "type": 3, + "vendor": "J.H. Artworks", + "aliases": + [ + ], + "url": "https://jh-artworks.com", + "parentRequirements": [], + "childRequirements": [], + "implemented": [], + "prefix": "CT" +} \ No newline at end of file diff --git a/CounterTable/module.php b/CounterTable/module.php new file mode 100644 index 0000000..158a6b3 --- /dev/null +++ b/CounterTable/module.php @@ -0,0 +1,182 @@ +RegisterPropertyFloat("Price",0.23); + $this->ReadPropertyString("Counters",""); + + $this->RegisterVariableString("htmlOutput", "Zählerübersicht",["PRESENTATION"=> VARIABLE_PRESENTATION_LEGACY, "PROFILE" => "~HTMLBox"],0); + + } + + // Überschreibt die intere IPS_ApplyChanges($id) Funktion + public function ApplyChanges() { + // Diese Zeile nicht löschen + parent::ApplyChanges(); + $this->checkTable(); + + + } + public function RequestAction($Ident, $Value) { + $varid = $this->GetIDForIdent($Ident); + SetValue($varid, $Value); + } + + + public function checkTable(){ + $Idvalue = $this->ReadPropertyFloat("Price"); + + + $arrString = $this->ReadPropertyString("Counters"); + $arr = json_decode($arrString); + + print_r($arr); + +/* + ' + + + Gesamt + + + + '.$ZaehlerGesamtGesamt.' + + + + '.$ZaehlerGesamtMonat.' + + + + '.$GrenzeZaehlerGesamt.' kWh + + + + '.$ZaehlerGesamtTag.' + + + + '.$KostenGesamt.'€ + + + ' + */ + + + } + + public function createTable($data) + { + $htmlprefix =' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '; + + $htmlsuffix = ' + + + + +
+ + Gesamt: + + Monat: + + Monatsgerenze: + + Heute: + + Kosten: +
+ Gesamt + + '.$ZaehlerGesamtGesamt.' + + '.$ZaehlerGesamtMonat.' + + '.$GrenzeZaehlerGesamt.' kWh + + '.$ZaehlerGesamtTag.' + + '.$KostenGesamt.'€ +
+ + '; + + SetValueString($this->GetIDForIdent("htmlOutput"),$htmlprefix.$data.$htmlsuffix); + } + + + +} + +?> \ No newline at end of file diff --git a/library.json b/library.json new file mode 100644 index 0000000..5e17695 --- /dev/null +++ b/library.json @@ -0,0 +1,13 @@ +{ + "id": "{FB801A08-0A7D-38F0-C5C1-C0B9147B11F5}", + "author": "J.H. Artworks", + "name": "Counters", + "url": "https://jh-artworks.com", + "compatibility": { + "version": "6.0", + "date": 1491343200 + }, + "version": "1.0", + "build": 1, + "date": 0 +} \ No newline at end of file