From 67858ed10ece500b2cf68dafb39886a0b873ec4c Mon Sep 17 00:00:00 2001 From: thedoc Date: Mon, 7 Dec 2009 22:38:20 +0100 Subject: first working version of TempFanControl plugin with Sensors and FanControl component --- lib/python/Components/Sources/Sensor.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/python/Components/Sources/Sensor.py (limited to 'lib/python/Components/Sources/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) -- cgit v1.2.3