Some QNAP devices don't have a fan. qcontrol will unsuccessfully try
to regulate the temperature and produce beeps when fan errors are
received.
These problems can be avoided with two steps:
1) Turn off the fan (even though there isn't one) so fan_error()
doesn't get called.
2) Make setfan() do nothing so the fan doesn't get turned on again.
Thanks to Axel Sommerfeldt for testing these changes.
This addresses Debian bug #712841
---
examples/ts209.lua | 12 ++++++++++++
examples/ts219.lua | 13 +++++++++++++
2 files changed, 25 insertions(+)
diff --git a/examples/ts209.lua b/examples/ts209.lua
index da301a5..51991c8 100644
--- a/examples/ts209.lua
+++ b/examples/ts209.lua
@@ -37,6 +37,13 @@ register("system-status")
-- Set to "false" to suppress the sounding of the buzzer
buzzer = true
+-- Set to "false" if your device doesn't have a fan (TS-109 and TS-109 II)
+has_fan = true
+
+-- Turn off fan if there is no fan to avoid fan_error() being called
+if not has_fan then
+ piccmd("fanspeed", "stop")
+end
function system_status( status )
logprint("System status: "..status)
@@ -88,6 +95,11 @@ end
last_fan_setting = nil
function setfan( speed )
+ -- Do nothing if there's no fan
+ if not has_fan then
+ return
+ end
+
if ( ( not last_fan_setting ) or
( last_fan_setting ~= speed ) ) then
logprint(string.format("ts209: setting fan to \"%s\"", speed))
diff --git a/examples/ts219.lua b/examples/ts219.lua
index ab28d93..97d9b8f 100644
--- a/examples/ts219.lua
+++ b/examples/ts219.lua
@@ -38,6 +38,14 @@ register("system-status")
-- Set to "false" to suppress the sounding of the buzzer
buzzer = true
+-- Set to "false" if your device doesn't have a fan (TS-119 and HS-210)
+has_fan = true
+
+-- Turn off fan if there is no fan to avoid fan_error() being called
+if not has_fan then
+ piccmd("fanspeed", "stop")
+end
+
function system_status( status )
logprint("System status: "..status)
if status == "start" then
@@ -128,6 +136,11 @@ end
last_fan_setting = nil
function setfan( temp, speed )
+ -- Do nothing if there's no fan
+ if not has_fan then
+ return
+ end
+
if ( ( not last_fan_setting ) or
( last_fan_setting ~= speed ) ) then
logprint(string.format("ts219: temperature %d setting fan to \"%s\"", temp, speed))
--
2.11.0