aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Sources
diff options
context:
space:
mode:
authorthedoc <thedoc@atom.(none)>2009-12-07 22:38:20 +0100
committerthedoc <thedoc@atom.(none)>2009-12-07 22:38:20 +0100
commit67858ed10ece500b2cf68dafb39886a0b873ec4c (patch)
tree70ce402d1a310eaf5299aaba929c0c9ddde2d0f7 /lib/python/Components/Sources
parent7950c2de2dbfd5bfee3650faaf45301187f7184a (diff)
downloadenigma2-67858ed10ece500b2cf68dafb39886a0b873ec4c.tar.gz
enigma2-67858ed10ece500b2cf68dafb39886a0b873ec4c.zip
first working version of TempFanControl plugin with Sensors and FanControl component
Diffstat (limited to 'lib/python/Components/Sources')
-rw-r--r--lib/python/Components/Sources/Makefile.am2
-rw-r--r--lib/python/Components/Sources/Sensor.py27
2 files changed, 28 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..3f6c8f0f
--- /dev/null
+++ b/lib/python/Components/Sources/Sensor.py
@@ -0,0 +1,27 @@
+from Components.Sensors import sensors
+
+from enigma import eTimer
+
+from Source import Source
+
+class SensorSource(Source):
+ def __init__(self, update_interval = 500, sensorid = 0):
+ 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)
+
+ def getValue(self):
+ return sensors.getSensorValue(self.sensorid)
+
+ def getUnit(self):
+ return sensors.getSensorUnit(self.sensorid)
+
+ def updateValue(self):
+ self.changed((self.CHANGED_POLL,))
+
+ def destroy(self):
+ self.update_timer.callback.remove(self.updateValue)