aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Sources
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2010-01-05 19:01:59 +0100
committerghost <andreas.monzner@multimedia-labs.de>2010-01-05 19:01:59 +0100
commitc352487661e7927d0068ef8fa69765055ff488d8 (patch)
tree90066f095c2fddcba46511358c7ae1d40e992ee3 /lib/python/Components/Sources
parent8c0e6b4a527f5666195683b7cc28c278a636da0d (diff)
parent48070d1e3868f6c7e5d61002f2b707249be5d016 (diff)
downloadenigma2-c352487661e7927d0068ef8fa69765055ff488d8.tar.gz
enigma2-c352487661e7927d0068ef8fa69765055ff488d8.zip
Merge remote branch 'remotes/origin/fantempplugin'
Diffstat (limited to 'lib/python/Components/Sources')
-rw-r--r--lib/python/Components/Sources/Makefile.am2
-rw-r--r--lib/python/Components/Sources/Sensor.py31
2 files changed, 32 insertions, 1 deletions
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index 6ef8cac6..436d31be 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -4,4 +4,4 @@ install_PYTHON = \
__init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \
FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py TunerInfo.py \
- RecordState.py Progress.py
+ RecordState.py Progress.py Sensor.py
diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py
new file mode 100644
index 00000000..e927bbf4
--- /dev/null
+++ b/lib/python/Components/Sources/Sensor.py
@@ -0,0 +1,31 @@
+from Components.Sensors import sensors
+
+from enigma import eTimer
+
+from Source import Source
+
+class SensorSource(Source):
+ def __init__(self, update_interval = 500, sensorid = None):
+ self.update_interval = update_interval
+ self.sensorid = sensorid
+ Source.__init__(self)
+
+ 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):
+ if self.sensorid is not None:
+ return sensors.getSensorValue(self.sensorid)
+ return None
+
+ def getUnit(self):
+ return sensors.getSensorUnit(self.sensorid)
+
+ def updateValue(self):
+ self.changed((self.CHANGED_POLL,))
+
+ def destroy(self):
+ if self.sensorid is not None:
+ self.update_timer.callback.remove(self.updateValue)