From 710b3ea19993c9fc15e38a57101494eb962c606c Mon Sep 17 00:00:00 2001 From: thedoc Date: Thu, 10 Dec 2009 14:52:36 +0100 Subject: support up to 8 fan/temp sensors --- lib/python/Components/Sources/Sensor.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/python/Components/Sources/Sensor.py') 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) -- cgit v1.2.3