From 2926baf1334beb8799465a41ed213bde6bf061cd Mon Sep 17 00:00:00 2001 From: jhartworks Date: Fri, 31 Jan 2025 14:17:46 +0100 Subject: [PATCH] fix --- CounterTable/module.php | 61 +++++++++++++++++++++-------------------- library.json | 2 +- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/CounterTable/module.php b/CounterTable/module.php index c6e1ae7..c359579 100644 --- a/CounterTable/module.php +++ b/CounterTable/module.php @@ -39,41 +39,42 @@ class CounterTable extends IPSModule { $dataoutput = ""; /// print_r($arr); - foreach($arr as $cnt){ + if($arr != NULL){ + foreach($arr as $cnt){ - $cost = 0.0; - $cost = $cnt->Monthly * $price; - $dataoutput .= ' - - - - '.$cnt->Name.' - + $cost = 0.0; + $cost = $cnt->Monthly * $price; + $dataoutput .= ' + - - '.$cnt->Total.' kWh - - - - '.$cnt->Monthly.' kWh - - - - '.$cnt->Weekly.' kWh - - - - '.$cnt->Daily.' kWh - - - - '.$cost.'€ - + + '.$cnt->Name.' + + + + '.$cnt->Total.' kWh + + + + '.$cnt->Monthly.' kWh + + + + '.$cnt->Weekly.' kWh + + + + '.$cnt->Daily.' kWh + + + + '.$cost.'€ + - '; + '; + } } - $this->createTable($dataoutput); /* diff --git a/library.json b/library.json index 212a1c4..de066fb 100644 --- a/library.json +++ b/library.json @@ -8,6 +8,6 @@ "date": 1491343200 }, "version": "1.0", - "build": 7, + "build": 8, "date": 0 } \ No newline at end of file