From 6fc73851aaa711c0ea56cde766e49d7311c21abd Mon Sep 17 00:00:00 2001 From: Weylin-fr Date: Mon, 20 Jan 2020 16:27:19 +0100 Subject: [PATCH 1/3] Update system.php get CPU temp from "/sys/class/thermal/thermal_zone0/temp" --- app/lib/system.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/lib/system.php b/app/lib/system.php index e7007d0a..4e4c8879 100644 --- a/app/lib/system.php +++ b/app/lib/system.php @@ -45,5 +45,10 @@ class System { public function systemLoadPercentage() { return intval(($this->loadAvg1Min() * 100) / $this->processorCount()); } + + public function systemTemperature() { + $cpuTemp = file_get_contents("/sys/class/thermal/thermal_zone0/temp"); + return number_format($cpuTemp/1000, 1); + } } From 9819c6a3e1c9c8bedf59da3966eb34b6a534a0bc Mon Sep 17 00:00:00 2001 From: Weylin-fr Date: Mon, 20 Jan 2020 16:30:44 +0100 Subject: [PATCH 2/3] Update system.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adding the CPU temp from a copy of CPU load. - The CPU temp cannot go to 100°C, so i multiply the temp to 1.2. This way the progress bar is full when CPU temp is 83°C or more. - The LAN Chipset supports up to 70°C, so i set the red progress bar to that threshold (source: https://www.raspberrypi.org/documentation/faqs/) --- templates/system.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/templates/system.php b/templates/system.php index c48befce..b50947ac 100755 --- a/templates/system.php +++ b/templates/system.php @@ -25,6 +25,16 @@ if ($cpuload > 90) { $cpuload_status = "success"; } +// cpu temp +$cputemp = $system->systemTemperature(); +if ($cputemp > 70) { + $cputemp_status = "danger"; +} elseif ($cputemp > 50) { + $cputemp_status = "warning"; +} else { + $cputemp_status = "success"; +} + ?>
@@ -63,12 +73,20 @@ if ($cpuload > 90) {
-
+
%
+
+
+
+
°C +
+
From 303347ac00a73676ab7ff22f02d8e8d0daed0c5c Mon Sep 17 00:00:00 2001 From: Weylin-fr Date: Wed, 22 Jan 2020 10:59:02 +0100 Subject: [PATCH 3/3] Update system.php removed "" as billz request it in the master branch --- templates/system.php | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/system.php b/templates/system.php index b50947ac..37ff7370 100755 --- a/templates/system.php +++ b/templates/system.php @@ -79,7 +79,6 @@ if ($cputemp > 70) { style="width: %">% -