X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FComponents%2FSources%2FSensor.py;h=e927bbf47a7e01433709479f408221f9f1ba952d;hp=3f6c8f0fbfd17d2e4f7288db57b33488c76e6567;hb=710b3ea19993c9fc15e38a57101494eb962c606c;hpb=67858ed10ece500b2cf68dafb39886a0b873ec4c diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py index 3f6c8f0..e927bbf 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)