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 @@ + +// Klassendefinition +class CounterTable extends IPSModule { + // Überschreibt die interne IPS_Create($id) Funktion + public function Create() { + // Diese Zeile nicht löschen. + parent::Create(); + + + $this->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: + | + ++ Monat: + | + ++ Monatsgerenze: + | + ++ Heute: + | + ++ Kosten: + | + + + + +
|---|---|---|---|---|---|
| + Gesamt + | + ++ '.$ZaehlerGesamtGesamt.' + | + ++ '.$ZaehlerGesamtMonat.' + | + ++ '.$GrenzeZaehlerGesamt.' kWh + | + ++ '.$ZaehlerGesamtTag.' + | + ++ '.$KostenGesamt.'€ + | + +