aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Sources
diff options
context:
space:
mode:
authorthedoc <thedoc@atom.(none)>2009-12-10 14:52:36 +0100
committerthedoc <thedoc@atom.(none)>2009-12-10 14:52:36 +0100
commit710b3ea19993c9fc15e38a57101494eb962c606c (patch)
tree93c940ef8e9f9e74890fb5a1f082c82d896c7de6 /lib/python/Components/Sources
parent67858ed10ece500b2cf68dafb39886a0b873ec4c (diff)
downloadenigma2-710b3ea19993c9fc15e38a57101494eb962c606c.tar.gz
enigma2-710b3ea19993c9fc15e38a57101494eb962c606c.zip
support up to 8 fan/temp sensors
Diffstat (limited to 'lib/python/Components/Sources')
-rw-r--r--lib/python/Components/Sources/Sensor.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py
index 3f6c8f0f..e927bbf4 100644
--- a/lib/python/Components/Sources/Sensor.py
+++ b/lib/python/Components/Sources/Sensor.py
@@ -5,17 +5,20 @@ from enigma import eTimer
from Source import Source
class SensorSource(Source):
- def __init__(self, update_interval = 500, sensorid = 0):
+ def __init__(self, update_interval = 500, sensorid = None):
self.update_interval = update_interval
self.sensorid = sensorid
Source.__init__(self)
- self.update_timer = eTimer()
- self.update_timer.callback.append(self.updateValue)
- self.update_timer.start(self.update_interval)
+ if sensorid is not None:
+ self.update_timer = eTimer()
+ self.update_timer.callback.append(self.updateValue)
+ self.update_timer.start(self.update_interval)
def getValue(self):
- return sensors.getSensorValue(self.sensorid)
+ if self.sensorid is not None:
+ return sensors.getSensorValue(self.sensorid)
+ return None
def getUnit(self):
return sensors.getSensorUnit(self.sensorid)
@@ -24,4 +27,5 @@ class SensorSource(Source):
self.changed((self.CHANGED_POLL,))
def destroy(self):
- self.update_timer.callback.remove(self.updateValue)
+ if self.sensorid is not None:
+ self.update_timer.callback.remove(self.updateValue)