("off", _("off")), ("on", _("on"))])
config.plugins.fancontrols.usetimer = ConfigSelection(default = "off", choices = [
("off", _("no")), ("on", _("yes"))])
-config.plugins.fancontrols.fanontime = ConfigInteger(default = 1, limits = (1, 100))
-config.plugins.fancontrols.fanofftime = ConfigInteger(default = 1, limits = (1, 100))
+config.plugins.fancontrols.fanontime = ConfigInteger(default = 5, limits = (1, 100))
+config.plugins.fancontrols.fanofftime = ConfigInteger(default = 60, limits = (1, 100))
class FancontrolConfiguration(Screen, ConfigListScreen):
- skin = """
- <screen name="FancontrolConfiguration" position="center,center" size="560,300" title="Standbymode Fancontrol settings" >
- <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
- <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ececec" backgroundColor="#9f1313" transparent="1" />
- <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" foregroundColor="#ececec" backgroundColor="#1f771f" transparent="1" />
- <widget name="config" zPosition="2" position="5,50" size="550,200" scrollbarMode="showOnDemand" transparent="1" />
- </screen>"""
+ skin = """
+ <screen position="center,center" size="560,300" title="Standbymode Fancontrol settings" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="110,10" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="310,10" size="140,40" alphatest="on" />
+
+ <widget source="key_red" render="Label" position="110,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
+ <widget source="key_green" render="Label" position="310,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
+
+ <widget name="config" zPosition="2" position="5,70" size="550,200" scrollbarMode="showOnDemand" transparent="1" />
+ </screen>
+ """
def __init__(self, session):
Screen.__init__(self, session)
self.session = session
self.list = []
ConfigListScreen.__init__(self, self.list,session = self.session)
- self.getFaninfo()
+# self.getFaninfo()
self.createSetup()
self["key_red"] = StaticText(_("Close"))
config.plugins.fancontrols.fanofftime.value = time
else:
config.plugins.fancontrols.fanofftime.value = 1
-# print config.plugins.fancontrols.standbymode.value, config.plugins.fancontrols.usetimer.value
-# print config.plugins.fancontrols.fanontime.value,config.plugins.fancontrols.fanofftime.value
except:
print 'Error read proc of fan'
def keySave(self):
ConfigListScreen.keySave(self)
try:
- fd=open('/proc/stb/system/standby_fan_off','w')
- if config.plugins.fancontrols.standbymode.value is not "off":
- fd.write('0')
- else:
- fd.write('1')
- fd.close()
- fd=open('/proc/stb/system/use_fan_timer','w')
- if config.plugins.fancontrols.usetimer.value is not "off":
- fd.write('1')
- fd.close()
- fd=open('/proc/stb/system/fan_on_time','w')
- fd.write('%s'%config.plugins.fancontrols.fanontime.value)
- fd.close()
- fd=open('/proc/stb/system/fan_off_time','w')
- fd.write('%s'%config.plugins.fancontrols.fanofftime.value)
- fd.close()
+ if config.plugins.fancontrols.standbymode.value is "on":
+ open('/proc/stb/system/standby_fan_off','w').write('0')
else:
- fd.write('0')
- fd.close()
+ open('/proc/stb/system/standby_fan_off','w').write('1')
+ if config.plugins.fancontrols.usetimer.value is "off":
+ open('/proc/stb/system/use_fan_timer','w').write('0')
+ else:
+ open('/proc/stb/system/use_fan_timer','w').write('1')
+ open('/proc/stb/system/fan_on_time','w').write('%s'%config.plugins.fancontrols.fanontime.value)
+ open('/proc/stb/system/fan_off_time','w').write('%s'%config.plugins.fancontrols.fanofftime.value)
except:
print 'Error write proc of fan'
return [(_("Fan Control"), openconfig, "fancontrol_config", 70)]
+def setfancontrol(reason, **kwargs):
+ try:
+ if config.plugins.fancontrols.standbymode.value == "on":
+ open('/proc/stb/system/standby_fan_off','w').write('0')
+ else:
+ open('/proc/stb/system/standby_fan_off','w').write('1')
+ if config.plugins.fancontrols.usetimer.value is "off":
+ open('/proc/stb/system/use_fan_timer','w').write('0')
+ else:
+ open('/proc/stb/system/use_fan_timer','w').write('1')
+ open('/proc/stb/system/fan_on_time','w').write('%s'%config.plugins.fancontrols.fanontime.value)
+ open('/proc/stb/system/fan_off_time','w').write('%s'%config.plugins.fancontrols.fanofftime.value)
+ except:
+ print 'Error to set fan control'
+
def Plugins(**kwargs):
- return PluginDescriptor(name=_("Fan control"), description="Fan Control", where = PluginDescriptor.WHERE_MENU, fnc=selSetup)
+ return [PluginDescriptor(name = "Fancontrols", description = "check Fan Control settings", where = PluginDescriptor.WHERE_AUTOSTART, fnc = setfancontrol),
+ PluginDescriptor(name=_("Fan control"), description="Fan Control", where = PluginDescriptor.WHERE_MENU, fnc=selSetup)]