From b644fed76211ca3a47ebfa052807ea26b617b873 Mon Sep 17 00:00:00 2001 From: jhartworks Date: Fri, 31 Jan 2025 14:14:38 +0100 Subject: [PATCH] fix --- CounterTable/module.php | 116 ++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/CounterTable/module.php b/CounterTable/module.php index 48fd78c..c6e1ae7 100644 --- a/CounterTable/module.php +++ b/CounterTable/module.php @@ -29,42 +29,69 @@ class CounterTable extends IPSModule { public function checkTable(){ - $Idvalue = $this->ReadPropertyFloat("Price"); + $price = $this->ReadPropertyFloat("Price"); $arrString = $this->ReadPropertyString("Counters"); $arr = json_decode($arrString); + - print_r($arr); + $dataoutput = ""; + /// print_r($arr); + + foreach($arr as $cnt){ + + $cost = 0.0; + $cost = $cnt->Monthly * $price; + $dataoutput .= ' + + + + '.$cnt->Name.' + + + + '.$cnt->Total.' kWh + + + + '.$cnt->Monthly.' kWh + + + + '.$cnt->Weekly.' kWh + + + + '.$cnt->Daily.' kWh + + + + '.$cost.'€ + + + '; + + } + + $this->createTable($dataoutput); /* - ' - - - Gesamt - - - - '.$ZaehlerGesamtGesamt.' - - - - '.$ZaehlerGesamtMonat.' - - - - '.$GrenzeZaehlerGesamt.' kWh - - - - '.$ZaehlerGesamtTag.' - - - - '.$KostenGesamt.'€ - - ' + Array + ( + [0] => stdClass Object + ( + [Name] => Blub + [Total] => 49294 + [Monthly] => 49294 + [Weekly] => 49294 + [Daily] => 49294 + [Limit] => 0.1 + ) + + ) + (Code: -32603) */ @@ -107,6 +134,7 @@ class CounterTable extends IPSModule { + Name: @@ -118,11 +146,11 @@ class CounterTable extends IPSModule { - Monatsgerenze: + Woche: - Heute: + Tag: @@ -135,33 +163,7 @@ class CounterTable extends IPSModule { - - - - Gesamt - - - - '.$ZaehlerGesamtGesamt.' - - - - '.$ZaehlerGesamtMonat.' - - - - '.$GrenzeZaehlerGesamt.' kWh - - - - '.$ZaehlerGesamtTag.' - - - - '.$KostenGesamt.'€ - - - '; + '; $htmlsuffix = '