From 169d38705b7680788d5ed7d8128951596f4cf928 Mon Sep 17 00:00:00 2001 From: mvoelkel Date: Wed, 31 Aug 2016 17:57:15 +0200 Subject: [PATCH] Added fan readout to monitor --- octoserve/var/monitor/fancontrol.lua | 8 ++++++ octoserve/var/www/monitor.html | 42 ++++++++++++++++++++++++---- octoserve/var/www/monitor.lua | 19 ++++++++++++- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/octoserve/var/monitor/fancontrol.lua b/octoserve/var/monitor/fancontrol.lua index e74bbe5..d25c580 100755 --- a/octoserve/var/monitor/fancontrol.lua +++ b/octoserve/var/monitor/fancontrol.lua @@ -59,6 +59,14 @@ if ddbridge then ddbridge:close() if devid == "0307dd01" then fanstate = 1 + ddbridge = io.open("/sys/class/ddbridge/ddbridge0/fanspeed1","r"); + if ddbridge then + local fs = tonumber(ddbridge:read("*l")) + ddbridge:close() + if fs > 0 and fs < 17000 then + fanstate = -2 + end + end end end diff --git a/octoserve/var/www/monitor.html b/octoserve/var/www/monitor.html index 0d39c5f..bb112ee 100644 --- a/octoserve/var/www/monitor.html +++ b/octoserve/var/www/monitor.html @@ -68,7 +68,16 @@ function myFunction(response) { document.getElementById("TGraph").style.display = "none"; document.getElementById("NoSensor").style.display = "block"; } - + if( Sensor.FanSpeed ) + { + document.getElementById("FanStatus").firstChild.nodeValue = "Fan: "+ Sensor.FanSpeed + " rpm"; + document.getElementById("FanStatus").style.display = "inline"; + } + if( Sensor.FanState >= 0 ) + { + document.getElementById("FanStatus").firstChild.nodeValue = "Fan: "+ ( Sensor.FanState > 0 ? "ON" : "OFF" ); + document.getElementById("FanStatus").style.display = "inline"; + } } function OnLoad() @@ -81,7 +90,7 @@ function OnLoad() - +
@@ -106,12 +115,35 @@ function OnLoad()
--> -

Frontend Temperature

-