Exemple #1
0
	def query(self):
		global FanFehler
		self.timer.stop()
		if config.plugins.FanControl.Fan.value != "disabled":
			self.Recording = self.session.nav.RecordTimer.isRecording()
			self.inStandby = Standby.inStandby
			if harddiskmanager.HDDCount() > 0 and int(strftime("%S")) < 10:
				self.HDDidle = HDDsSleeping()
				if strftime("%M")[-1:] == "0":
					GetHDDtemp(False)
			if config.plugins.FanControl.EnableThread.value == True:
				if Briefkasten.qsize()<=3:
					Briefkasten.put(1) 
				else:
					FClog("Queue full, Thread hanging?")
			else:
				self.queryRun()
			if ZielRPM > 0 and AktRPM == 0:
				FanFehler += 1
				if FanFehler > 90:
					FanFehler -= 18
					FClog("Fan Error")
					if config.plugins.FanControl.ShowError.value == "true" and not self.inStandby:
						Notifications.AddNotification(MessageBox, _("Fan is not working!"), type=MessageBox.TYPE_INFO, timeout=5)
					if config.plugins.FanControl.ShowError.value == "shutdown":
						self.FC2AskShutdown()
			else:
				FanFehler = 0
			if AktTemp >= config.plugins.FanControl.ShutdownTemp.value:
				FClog("Emergency Shutdown %dC" % AktTemp)
				self.FC2AskShutdown()
		self.timer.startLongTimer(10)
Exemple #2
0
def checkHardDisk():
    if harddiskmanager.HDDCount():
        for hdd in harddiskmanager.HDDList():
            if hdd[1].idle_running and hdd[
                    1].max_idle_time and not hdd[1].isSleeping():
                return True
    return False
Exemple #3
0
    def __init__(self, session, menu_path=""):
        Screen.__init__(self, session)
        screentitle = _("Initialise Devices")
        self.menu_path = menu_path
        if config.usage.show_menupath.value == 'large':
            self.menu_path += screentitle
            title = self.menu_path
            self["menu_path_compressed"] = StaticText("")
            self.menu_path += ' / '
        elif config.usage.show_menupath.value == 'small':
            title = screentitle
            condtext = ""
            if self.menu_path and not self.menu_path.endswith(' / '):
                condtext = self.menu_path + " >"
            elif self.menu_path:
                condtext = self.menu_path[:-3] + " >"
            self["menu_path_compressed"] = StaticText(condtext)
            self.menu_path += screentitle + ' / '
        else:
            title = screentitle
            self["menu_path_compressed"] = StaticText("")
        Screen.setTitle(self, title)

        self.skinName = "HarddiskSelection"  # For derived classes
        if harddiskmanager.HDDCount() == 0:
            tlist = [(_("no storage devices found"), 0)]
            self["hddlist"] = MenuList(tlist)
        else:
            self["hddlist"] = MenuList(harddiskmanager.HDDList())

        self["actions"] = ActionMap(["OkCancelActions"], {
            "ok": self.okbuttonClick,
            "cancel": self.close
        })
Exemple #4
0
	def __init__(self, session):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Initialization"))
		self.skinName = "HarddiskSelection" # For derived classes
		
		menu = []
		if harddiskmanager.HDDCount() == 0:
			menu.append(SubHarddiskMenuEntryComponent((_("no storage devices found")), 0))
		else:
			for x in harddiskmanager.HDDList():
				menu.append(SubHarddiskMenuEntryComponent(x[0], x))

		self["hddlist"] = HarddiskMenuList(menu)
		
		self["key_red"] = Label(_("Exit"))
		self["key_green"] = Label(_("Select"))
		self["key_yellow"] = Label()
		self["key_blue"] = Label()
		self["actions"] = ActionMap(["SetupActions"],
		{
			"save" : self.okbuttonClick,
			"ok": self.okbuttonClick,
			"cancel": self.close,
			"red": self.close
		})
Exemple #5
0
def devDiskInfo(ruta='/', txtini='', sidormido=False):
    if not txtini == '':
        txtini = txtini + ': '
    if sidormido and ruta == '/hdd/':
        try:
            cadret = ''
            if harddiskmanager.HDDCount():
                for hdd in harddiskmanager.HDDList():
                    if ('pci' in hdd[1].phys_path or 'ahci' in hdd[1].phys_path
                        ) and hdd[1].isSleeping() and hdd[1].max_idle_time:
                        cadret = _('Sleep')
                        break

            if not cadret == '':
                return txtini + '(' + cadret + ')'
        except:
            return ''

    try:
        stat = statvfs(ruta)
    except OSError:
        return ''

    try:
        percent = '(' + str(100 * stat.f_bavail // stat.f_blocks) + '%)'
        total = stat.f_bsize * stat.f_blocks
        free = stat.f_bfree * stat.f_bsize
        if total == 0:
            return ''
        return txtini + Humanizer(total) + ', ' + Humanizer(
            free) + ' ' + percent + ' ' + _('free')
    except:
        return ''
Exemple #6
0
	def getHDD(self):
		if harddiskmanager.HDDCount() > 0 and config.plugins.FanControl.CheckHDDTemp.value !="never":
			GetHDDtemp(True)
			for hdd in harddiskmanager.HDDList():
				if hdd[1].model().startswith("ATA"):
					if hdd[1].isSleeping():
						(stat,wert)=getstatusoutput("hdparm -y %s" % hdd[1].getDeviceName())
Exemple #7
0
    def timerPoll(self):
        timeout = self.polltime
        FanConf = config.plugins.FanSetup
        mode = FanConf.mode.value
        timeset = FanConf.timeset.value

        # check time settings and if need change fan mode
        if mode != "off" and timeset != "none":
            ts = localtime()
            nowsec = (ts.tm_hour * 3600) + (ts.tm_min * 60)
            offlist = config.plugins.FanSetup.timestartoff.value
            offsec = (offlist[0] * 3600) + (offlist[1] * 60)
            onlist = config.plugins.FanSetup.timeendoff.value
            onsec = (onlist[0] * 3600) + (onlist[1] * 60)
            invert = False
            if offsec > onsec:
                invert = True
                offsec, onsec = onsec, offsec
            if (offsec <= nowsec < onsec):
                if not invert:
                    mode = timeset
                timeout = min(self.polltime, onsec - nowsec)
            elif nowsec < offsec:
                if invert:
                    mode = timeset
                timeout = min(self.polltime, offsec - nowsec)
            else:
                if invert:
                    mode = timeset
                timeout = min(self.polltime, 86400 - nowsec)

        # check hdd settings (sleeping and temperature hdd's)
        if FanConf.hddwatch.value != "none" and mode == "off":
            hddcount = harddiskmanager.HDDCount()
            if hddcount:
                if FanConf.hddwatch.value == "sleep" and FanConf.hddsleep.value is True:
                    sleepcount = 0
                    hddlist = harddiskmanager.HDDList()
                    for x in range(hddcount):
                        if hddlist[x][1].isSleeping():
                            sleepcount += 1
                        else:
                            mode = "on"
                    if sleepcount == hddcount:
                        mode = "off"
                elif FanConf.hddwatch.value == "temp" and FanConf.hddtemp.value != 0:
                    hddlist = harddiskmanager.HDDList()
                    if not hddlist[0][1].isSleeping():
                        hddlist = tempwatcher.getHddTempList()
                        for d in hddlist:
                            hddtemp = hddlist[d]["temp"]
                            if hddtemp >= FanConf.hddtemp.value:
                                mode = "on"
                            else:
                                mode = "off"
                    else:
                        mode = "off"
        self.applySettings(mode)
        self.timer.start(timeout * 1000, True)
Exemple #8
0
 def wiz_ard(self):
     if config.wizardsetup.pluginmoveoutwizard == True:
         if harddiskmanager.HDDCount() == 0:
             print("no Device found for moveout")
         else:
             self.session.open(MovePlugins)
     if config.wizardsetup.OpenNFRaddonsWizardSetup.value == True:
         self.session.open(OpenNFRWizardSetup)
     if config.wizardsetup.UserInterfacePositionerWizard.value == True:
         self.Console = Console()
         self.Console.ePopen(
             '/usr/bin/showiframe /usr/share/enigma2/hd-testcard.mvi')
         self.session.open(UserInterfacePositionerWizard)
     if config.wizardsetup.OpenWebifConfig.value == True:
         self.session.open(OpenWebifConfig)
     if config.wizardsetup.bootvideomoveout.value == True and config.wizardsetup.pluginwizard.value == True:
         if harddiskmanager.HDDCount() == 0:
             print("no Device found for moveout")
         else:
             self.session.open(MoveVideos)
     if config.wizardsetup.bootvideo.value == True and config.wizardsetup.pluginwizard.value == True:
         self.session.open(BootvideoSetupScreen)
     if config.wizardsetup.bootlogomoveout.value == True and config.wizardsetup.pluginwizard.value == True:
         if harddiskmanager.HDDCount() == 0:
             print("no Device found for moveout")
         else:
             self.session.open(MoveSpinner)
     if config.wizardsetup.bootlogo.value == True and config.wizardsetup.pluginwizard.value == True:
         self.session.open(BootlogoSetupScreen)
     if config.wizardsetup.spinnermoveout.value == True and config.wizardsetup.pluginwizard.value == True:
         if harddiskmanager.HDDCount() == 0:
             print("no Device found for moveout")
         else:
             self.session.open(MoveSpinner)
     if config.wizardsetup.spinnerselect.value == True and config.wizardsetup.pluginwizard.value == True:
         SpinnerSelector(self.session)
     if config.wizardsetup.pluginwizard.value == True:
         from Plugins.Extensions.Infopanel.PluginWizard import PluginInstall
         self.session.open(PluginInstall)
     if config.wizardsetup.poweroffsetup.value == True:
         self.openSetup("remotesetup")
     self.close()
 def __init__(self, session):
     Screen.__init__(self, session)
     Screen.setTitle(self, _('Initialization'))
     self.skinName = 'HarddiskSelection'
     if harddiskmanager.HDDCount() == 0:
         tlist = [(_('no storage devices found'), 0)]
         self['hddlist'] = MenuList(tlist)
     else:
         self['hddlist'] = MenuList(harddiskmanager.HDDList())
     self['actions'] = ActionMap(['OkCancelActions'], {'ok': self.okbuttonClick,
      'cancel': self.close})
Exemple #10
0
    def createSetup(self):
        self.testtype = ConfigSelection(choices={
            "quick": _("Quick"),
            "random": _("Random"),
            "complete": _("Complete")
        },
                                        default="quick")
        self.testtypeEntry = getConfigListEntry(_("Test type"), self.testtype)
        self.list.append(self.testtypeEntry)

        self.loopsfailed = ConfigSelection(choices={
            "-1": "Every known",
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8"
        },
                                           default="3")
        self.loopsfailedEntry = getConfigListEntry(
            _("Stop testing plane after # failed transponders"),
            self.loopsfailed)
        self.list.append(self.loopsfailedEntry)

        self.loopssuccessful = ConfigSelection(choices={
            "-1": "Every known",
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8"
        },
                                               default="1")
        self.loopssuccessfulEntry = getConfigListEntry(
            _("Stop testing plane after # successful transponders"),
            self.loopssuccessful)
        self.list.append(self.loopssuccessfulEntry)

        self.log = ConfigYesNo(False)
        if harddiskmanager.HDDCount() > 0:
            self.logEntry = getConfigListEntry(_("Log results to harddisk"),
                                               self.log)
            self.list.append(self.logEntry)

        self["config"].list = self.list
        self["config"].l.setList(self.list)
Exemple #11
0
    def __init__(self, session):
        Screen.__init__(self, session)
        if harddiskmanager.HDDCount() == 0:
            tlist = []
            tlist.append((_("no storage devices found"), 0))
            self["hddlist"] = MenuList(tlist)
        else:
            self["hddlist"] = MenuList(harddiskmanager.HDDList())

        self["actions"] = ActionMap(["OkCancelActions"], {
            "ok": self.okbuttonClick,
            "cancel": self.close
        })
Exemple #12
0
    def __init__(self, session):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Initialization"))
        self.skinName = "HarddiskSelection"  # For derived classes
        if harddiskmanager.HDDCount() == 0:
            tlist = [(_("no storage devices found"), 0)]
            self["hddlist"] = MenuList(tlist)
        else:
            self["hddlist"] = MenuList(harddiskmanager.HDDList())

        self["actions"] = ActionMap(["OkCancelActions"], {
            "ok": self.okbuttonClick,
            "cancel": self.close
        })
Exemple #13
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self.skinName = "HarddiskSelection"  # For derived classes
     if harddiskmanager.HDDCount() == 0:
         tlist = []
         tlist.append((_("no storage devices found"), 0))
         self["hddlist"] = MenuList(tlist)
     else:
         self["hddlist"] = MenuList(harddiskmanager.HDDList())
     self["key_red"] = Label(_("Cancel"))
     self["actions"] = ActionMap(["OkCancelActions"], {
         "ok": self.okbuttonClick,
         "cancel": self.close
     })
Exemple #14
0
 def wiz_ard(self):
     if config.wizardsetup.pluginmoveoutwizard == True:
         if harddiskmanager.HDDCount() == 0:
             print "no Device found for moveout"
         else:
             self.session.open(MovePlugins)
     if config.wizardsetup.OpenNFRaddonsWizardSetup.value == True:
         self.session.open(OpenNFRWizardSetup)
     if config.wizardsetup.UserInterfacePositionerWizard.value == True:
         self.session.open(UserInterfacePositionerWizard)
     if config.wizardsetup.OpenWebifConfig.value == True:
         self.session.open(OpenWebifConfig)
     if config.wizardsetup.bootvideomoveout.value == True and config.wizardsetup.pluginwizard.value == True:
         if harddiskmanager.HDDCount() == 0:
             print "no Device found for moveout"
         else:
             self.session.open(MoveVideos)
     if config.wizardsetup.bootvideo.value == True and config.wizardsetup.pluginwizard.value == True:
         self.session.open(BootvideoSetupScreen)
     if config.wizardsetup.bootlogomoveout.value == True and config.wizardsetup.pluginwizard.value == True:
         if harddiskmanager.HDDCount() == 0:
             print "no Device found for moveout"
         else:
             self.session.open(MoveSpinner)
     if config.wizardsetup.bootlogo.value == True and config.wizardsetup.pluginwizard.value == True:
         self.session.open(BootlogoSetupScreen)
     if config.wizardsetup.spinnermoveout.value == True and config.wizardsetup.pluginwizard.value == True:
         if harddiskmanager.HDDCount() == 0:
             print "no Device found for moveout"
         else:
             self.session.open(MoveSpinner)
     if config.wizardsetup.spinnerselect.value == True and config.wizardsetup.pluginwizard.value == True:
         SpinnerSelector(self.session)
     if config.wizardsetup.pluginwizard.value == True:
         from Plugins.Extensions.Infopanel.PluginWizard import PluginInstall
         self.session.open(PluginInstall)
     self.close()
Exemple #15
0
 def showHarddiskPopup(self, dev=None, media_state=None):
     from Components.Harddisk import harddiskmanager
     if not self.HDDDetectedCB in harddiskmanager.delayed_device_Notifier:
         harddiskmanager.delayed_device_Notifier.append(self.HDDDetectedCB)
     if config.misc.initialharddisknotification.value:
         from Screens.MessageBox import MessageBox
         if harddiskmanager.HDDCount(
         ) and not harddiskmanager.HDDEnabledCount():
             Notifications.AddNotificationWithCallback(self.HDDDetectedAnswer, MessageBox, _("Unconfigured storage devices found!")  + "\n" \
              + _("Please make sure to set up your storage devices with the storage management in menu -> setup -> system -> storage devices.") + "\n\n" \
              + _("Set up your storage device now?"), type = MessageBox.TYPE_YESNO, timeout = 15, default = False, domain = "InfoBar")
             config.misc.initialharddisknotification.value = False
             config.misc.initialharddisknotification.save()
     elif config.misc.missingdefaultstoragenotification.value and not config.misc.initialharddisknotification.value:
         from Screens.ChoiceBox import ChoiceBox
         from Components.UsageConfig import defaultStorageDevice
         choices = [(_("OK, do nothing"), "ok"),
                    (_("OK, and don't ask again"), "ok_always")]
         if harddiskmanager.HDDCount():
             choices.append(
                 (_("OK, and set up a new default storage device"),
                  "ok_setup"))
         titletxt = _("Default storage device is not available!") + "\n"
         if dev is None and defaultStorageDevice(
         ) != "<undefined>" and harddiskmanager.isDefaultStorageDeviceActivebyUUID(
                 defaultStorageDevice()) is False:
             Notifications.AddNotificationWithCallback(self.missingDefaultHDDAnswer, ChoiceBox, title = titletxt \
              + _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> storage devices.") + "\n", list = choices, domain = "InfoBar")
         elif dev is not None and defaultStorageDevice(
         ) != "<undefined>" and harddiskmanager.isDefaultStorageDeviceActivebyUUID(
                 defaultStorageDevice()) is False:
             part = harddiskmanager.getPartitionbyDevice(dev)
             if part is not None and part.uuid is not None and media_state is not None and media_state == "remove_default":
                 titletxt = _("Default storage device was removed!") + "\n"
                 Notifications.AddNotificationWithCallback(self.missingDefaultHDDAnswer, ChoiceBox, title = titletxt \
                  + _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> storage devices.") + "\n", list = choices, domain = "InfoBar")
	def __init__(self, session, menu_path=""):
		Screen.__init__(self, session)
		screentitle = _("Initialize Devices")
		self.menu_path = menu_path
		if config.usage.show_menupath.value == 'large':
			self.menu_path += screentitle
			title = self.menu_path
			self["menu_path_compressed"] = StaticText("")
			self.menu_path += ' / '
		elif config.usage.show_menupath.value == 'small':
			title = screentitle
			condtext = ""
			if self.menu_path and not self.menu_path.endswith(' / '):
				condtext = self.menu_path + " >"
			elif self.menu_path:
				condtext = self.menu_path[:-3] + " >"
			self["menu_path_compressed"] = StaticText(condtext)
			self.menu_path += screentitle + ' / '
		else:
			title = screentitle
			self["menu_path_compressed"] = StaticText("")
		Screen.setTitle(self, title)

		self.skinName = "HarddiskSelection" # For derived classes
		
		menu = []
		if harddiskmanager.HDDCount() == 0:
			menu.append(SubHarddiskMenuEntryComponent((_("no storage devices found")), 0))
		else:
			for x in harddiskmanager.HDDList():
				menu.append(SubHarddiskMenuEntryComponent(x[0], x))

		self["hddlist"] = HarddiskMenuList(menu)
		
		self["key_red"] = Label(_("Exit"))
		self["key_green"] = Label(_("Select"))
		self["key_yellow"] = Label()
		self["key_blue"] = Label()
		self["actions"] = ActionMap(["SetupActions"],
		{
			"save" : self.okbuttonClick,
			"ok": self.okbuttonClick,
			"cancel": self.close,
			"red": self.close
		})
Exemple #17
0
 def isHDD(self):
     self.hdd_list = []
     if harddiskmanager.HDDCount():
         for hdd in harddiskmanager.HDDList():
             if hdd[1].idle_running and not hdd[1].sdmmc:
                 if self.type == self.ALL:
                     self.hdd_list.append(hdd)
                 elif self.type == self.INTERNAL_ALL:
                     if hdd[1].internal:
                         self.hdd_list.append(hdd)
                 elif self.type == self.INTERNAL_HDD:
                     if hdd[1].internal and hdd[1].rotational:
                         self.hdd_list.append(hdd)
                 elif self.type == self.INTERNAL_SSD:
                     if hdd[1].internal and not hdd[1].rotational:
                         self.hdd_list.append(hdd)
                 elif self.type == self.EXTERNAL:
                     if not hdd[1].internal:
                         self.hdd_list.append(hdd)
Exemple #18
0
def GetHDDtemp(OneTime):
	global AktHDD
	AktHDD = []
	if harddiskmanager.HDDCount() > 0 and config.plugins.FanControl.CheckHDDTemp.value != "never" or OneTime == True:
		for hdd in harddiskmanager.HDDList():
			if hdd[1].model().startswith("ATA") and hdd[1].getDeviceName() not in FC2HDDignore:
				sleeptime = int((time.time() - hdd[1].last_access))
				if config.plugins.FanControl.CheckHDDTemp.value == "true" or (config.plugins.FanControl.CheckHDDTemp.value == "auto" and not disableHDDread) or ((not hdd[1].isSleeping()) and sleeptime < 120) or OneTime == True:
					(stat,wert)=ReadHDDtemp(hdd[1].getDeviceName())
					if stat == 0:
						try:
							AktHDD.append(int(wert[wert.find("Always")+6:].replace(" ","").replace("-","")[:2]))
						except:
							AktHDD.append(0)
					if len(AktHDD) == 0:
						AktHDD = [0]
					FClog("HDD Temp %dC" % (AktHDD[-1]))
	if len(AktHDD) == 0:
		AktHDD = [0]
	return
Exemple #19
0
	def updateTemp(self):
		templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE)
		tempcount = len(templist)
		for count in range(tempcount):
			tt = sensors.getSensorValue(count)
			self["ProTemp%d" % count].value = int((tt-30)*100/(55-30))
			if sensors.getSensorName(count) == "undefined":
				self["TxtTemp%d" % count].setText(_("%s   %02d C") % (TempName[count], tt))
			else:
				self["TxtTemp%d" % count].setText(_("%s   %02d C") % (sensors.getSensorName(count), tt))
		if harddiskmanager.HDDCount() > 0 and len(AktHDD) > 0:
			if max(AktHDD) > 0:
				self["ProHDD"].value = int((max(AktHDD)-30)*100/(55-30))
				self["TxtHDD"].setText(_("%s   %02d C") % ("HDD", max(AktHDD)))
			elif config.plugins.FanControl.CheckHDDTemp.value !="never":
				self["TxtHDD"].setText(_("press Info for HDD-Temp"))
		self["TxtFan"].setText(_("Current rpm  %4d") % (AktRPM))
		self["ProFan"].value = int((AktRPM-config.plugins.FanControl.minRPM.value)*100/Test0(config.plugins.FanControl.maxRPM.value-config.plugins.FanControl.minRPM.value))
		if tempcount>1:
			self["TxtFC2Temp"].setText("%4.1f" % AktTemp)
		self.temp_timer.start(2000, True)
Exemple #20
0
def HDDtestTemp():
	global disableHDDread
	if harddiskmanager.HDDCount() > 0 and config.plugins.FanControl.CheckHDDTemp.value !="never":
		disableHDDread = False
		for hdd in harddiskmanager.HDDList():
			if hdd[1].model().startswith("ATA"):
				FClog("%s %s Mode:%s" % (hdd[1].model(), hdd[1].getDeviceName(), config.plugins.FanControl.CheckHDDTemp.value))
				if config.plugins.FanControl.CheckHDDTemp.value == "auto":
					(stat,wert)=getstatusoutput("hdparm -y %s" % hdd[1].getDeviceName())
					time.sleep(0.5)
					(stat,wert)=ReadHDDtemp(hdd[1].getDeviceName())
					if stat != 0:
						(stat,wert)=getstatusoutput("smartctl --smart=on %s" % hdd[1].getDeviceName())
						FClog("HDD Temperature not readable -> Ignore")
						FC2HDDignore.append(hdd[1].getDeviceName())
					time.sleep(0.5)
					(stat,wert)=getstatusoutput("hdparm -C %s" % hdd[1].getDeviceName())
					if wert.find("standby")>0:
						FClog("HDD supports Temp reading without Spinup")
					else:
						if hdd[1].isSleeping():
							(stat,wert)=getstatusoutput("hdparm -y %s" % hdd[1].getDeviceName())
							FClog("HDD not supports Temp reading without Spinup -> Ignore")
							FC2HDDignore.append(hdd[1].getDeviceName())
Exemple #21
0
    def CheckElektro(self):
        # first set the next wakeuptime - it would be much better to call that function on sleep. This will be a todo!
        self.setNextWakeuptime()

        #convert to seconds
        time_s = self.getTime()
        ltime = localtime()
        if config.plugins.elektro.profile.value == "1":
            config_wakeup = config.plugins.elektro.wakeup
            config_sleep = config.plugins.elektro.sleep
            config_nextday = config.plugins.elektro.nextday
        else:
            config_wakeup = config.plugins.elektro.wakeup2
            config_sleep = config.plugins.elektro.sleep2
            config_nextday = config.plugins.elektro.nextday2

        #Which day is it? The next day starts at nextday
        if debug:
            print pluginPrintname, "wday 1:", str(ltime.tm_wday)
        if time_s < self.clkToTime(config_nextday):
            day = (ltime.tm_wday - 1) % 7
        else:
            day = ltime.tm_wday
        if debug:
            print pluginPrintname, "wday 2:", str(day)

        #Let's get the day
        wakeuptime = self.clkToTime(config_wakeup[day])
        sleeptime = self.clkToTime(config_sleep[day])

        print pluginPrintname, "Profile:", config.plugins.elektro.profile.value
        print pluginPrintname, "Nextday:", self.getPrintTime(
            self.clkToTime(config.plugins.elektro.nextday))
        print pluginPrintname, "Current time:", self.getPrintTime(time_s)
        print pluginPrintname, "Wakeup time:", self.getPrintTime(wakeuptime)
        print pluginPrintname, "Sleep time:", self.getPrintTime(sleeptime)

        #convert into relative Times
        time_s = self.getReltime(time_s)
        wakeuptime = self.getReltime(wakeuptime)
        sleeptime = self.getReltime(sleeptime)

        if debug:
            print pluginPrintname, "Current Rel-time:", self.getPrintTime(
                time_s)
            print pluginPrintname, "Wakeup Rel-time:", self.getPrintTime(
                wakeuptime)
            print pluginPrintname, "Sleep Rel-time:", self.getPrintTime(
                sleeptime)

        #let's see if we should be sleeping
        trysleep = False
        if time_s < (wakeuptime - elektroShutdownThreshold
                     ):  # Wakeup is in the future -> sleep!
            trysleep = True
            print pluginPrintname, "Wakeup!", str(time_s), " <", str(
                wakeuptime)
        if sleeptime < time_s:  #Sleep is in the past -> sleep!
            trysleep = True
            print pluginPrintname, "Sleep:", str(sleeptime), " <", str(time_s)

        #We are not tying to go to sleep anymore -> maybe go to sleep again the next time
        if trysleep == False:
            self.dontsleep = False

        #The User aborted to got to sleep -> Don't go to sleep.
        if self.dontsleep:
            trysleep = False

        # If we are in holydaymode we should try to got to sleep anyway
        # This should be set after self.dontsleep has been handled
        if config.plugins.elektro.holiday.value:
            trysleep = True

        # We are not enabled -> Dont go to sleep (This could have been catched earlier!)
        if config.plugins.elektro.enable.value == False:
            trysleep = False

        # Only go to sleep if we are in standby or sleep is forced by settings
        if not ((Standby.inStandby) or
                (config.plugins.elektro.force.value == True)):
            trysleep = False

        # No Sleep while recording
        if self.session.nav.RecordTimer.isRecording():
            trysleep = False

        # No Sleep on Online IPs - joergm6
        if trysleep == True and config.plugins.elektro.IPenable.value == True:
            for i in range(10):
                ip = "%d.%d.%d.%d" % tuple(config.plugins.elektro.ip[i].value)
                if ip != "0.0.0.0":
                    if ping.doOne(ip, 0.1) != None:
                        print pluginPrintname, ip, "online"
                        trysleep = False
                        break

        # No Sleep on HDD running - joergm6
        if (config.plugins.elektro.hddsleep.value
                == True) and (harddiskmanager.HDDCount() > 0):
            hddlist = harddiskmanager.HDDList()
            if hddlist[0][1].model().startswith("ATA"):
                if not hddlist[0][1].isSleeping():
                    trysleep = False

        # Will there be a recording in a short while?
        nextRecTime = self.session.nav.RecordTimer.getNextRecordingTime()
        if (nextRecTime > 0) and (nextRecTime -
                                  (int)(time()) < elektroShutdownThreshold):
            trysleep = False

        # Looks like there really is a reason to go to sleep -> Lets try it!
        if trysleep:
            #self.();
            try:
                self.session.openWithCallback(self.DoElektroSleep,
                                              MessageBox,
                                              _("Go to sleep now?"),
                                              type=MessageBox.TYPE_YESNO,
                                              timeout=60)
            except:
                #reset the timer and try again
                self.TimerSleep.startLongTimer(elektrostarttime)

        #set Timer, which calls this function again.
        self.TimerSleep.startLongTimer(elektrostarttime)
Exemple #22
0
    def CheckElektro(self):
        # first set the next wakeuptime - it would be much better to call that function on sleep. This will be a todo!
        self.setNextWakeuptime()

        #convert to seconds
        time_s = self.getTime()
        ltime = localtime()

        print "[Elektro] Testtime; " + self.getPrintTime(2 * 60 * 60)

        #Which day is it? The next day starts at nextday
        print "[Elektro] wday 1: " + str(ltime.tm_wday)
        if time_s < self.clkToTime(config.plugins.elektro.nextday):
            day = (ltime.tm_wday - 1) % 7
        else:
            day = ltime.tm_wday

        print "[Elektro] wday 2: " + str(day)

        #Let's get the day
        wakeuptime = self.clkToTime(config.plugins.elektro.wakeup[day])
        sleeptime = self.clkToTime(config.plugins.elektro.sleep[day])
        print "[Elektro] Current time: " + self.getPrintTime(time_s)
        print "[Elektro] Wakeup time: " + self.getPrintTime(wakeuptime)
        print "[Elektro] Sleep time: " + self.getPrintTime(sleeptime)

        #convert into relative Times
        time_s = self.getReltime(time_s)
        wakeuptime = self.getReltime(wakeuptime)
        sleeptime = self.getReltime(sleeptime)

        print "[Elektro] Current Rel-time: " + self.getPrintTime(time_s)
        print "[Elektro] Wakeup Rel-time: " + self.getPrintTime(wakeuptime)
        print "[Elektro] Sleep Rel-time: " + self.getPrintTime(sleeptime)

        #let's see if we should be sleeping
        trysleep = False
        if time_s < (wakeuptime - elektroShutdownThreshold
                     ):  # Wakeup is in the future -> sleep!
            trysleep = True
            print "[Elektro] Wakeup!" + str(time_s) + " < " + str(wakeuptime)
        if sleeptime < time_s:  #Sleep is in the past -> sleep!
            trysleep = True
            print "[Elektro] Sleep: " + str(sleeptime) + " < " + str(time_s)

        #We are not tying to go to sleep anymore -> maybe go to sleep again the next time
        if trysleep == False:
            self.dontsleep = False

        #The User aborted to got to sleep -> Don't go to sleep.
        if self.dontsleep:
            trysleep = False

        # If we are in holydaymode we should try to got to sleep anyway
        # This should be set after self.dontsleep has been handled
        if config.plugins.elektro.holiday.value:
            trysleep = True

        # We are not enabled -> Dont go to sleep (This could have been catched earlier!)
        if config.plugins.elektro.enable.value == False:
            trysleep = False

        # Only go to sleep if we are in standby or sleep is forced by settings
        if not ((Standby.inStandby) or
                (config.plugins.elektro.force.value == True)):
            trysleep = False

        # No Sleep while recording
        if self.session.nav.RecordTimer.isRecording():
            trysleep = False

        # No Sleep on HDD running - joergm6
        if (config.plugins.elektro.hddsleep.value
                == True) and (harddiskmanager.HDDCount() > 0):
            hddlist = harddiskmanager.HDDList()
            if not hddlist[0][1].isSleeping():
                trysleep = False

        # Will there be a recording in a short while?
        nextRecTime = self.session.nav.RecordTimer.getNextRecordingTime()
        if (nextRecTime > 0) and (nextRecTime -
                                  (int)(time()) < elektroShutdownThreshold):
            trysleep = False

        # Looks like there really is a reason to go to sleep -> Lets try it!
        if trysleep:
            #self.();
            try:
                self.session.openWithCallback(self.DoElektroSleep,
                                              MessageBox,
                                              _("Go to sleep now?"),
                                              type=MessageBox.TYPE_YESNO,
                                              timeout=60)
            except:
                #reset the timer and try again
                self.TimerSleep.startLongTimer(elektrostarttime)

        #set Timer, which calls this function again.
        self.TimerSleep.startLongTimer(elektrostarttime)
Exemple #23
0
 def timerPoll(self):
     FanConf = config.plugins.extrafancontrol
     self.polltime = int(FanConf.interval.value)
     timeout = self.polltime
     speed = FanConf.fanspeed.value
     is_standby_box = Standby.inStandby is not None
     standbyspeed = FanConf.speedstandby.value == "other" and is_standby_box
     mode = FanConf.mode.value
     prev_mode = mode
     timeset = FanConf.timeset.value
     hddwatch = FanConf.hddwatch.value
     syswatch = FanConf.syswatch.value
     set_altspeed = False
     # check time settings and if need change fan mode
     if mode != "off" and timeset != "none":
         altspeed = False
         ts = localtime()
         nowsec = (ts.tm_hour * 3600) + (ts.tm_min * 60)
         offlist = FanConf.timestartoff.value
         offsec = (offlist[0] * 3600) + (offlist[1] * 60)
         onlist = FanConf.timeendoff.value
         onsec = (onlist[0] * 3600) + (onlist[1] * 60)
         invert = False
         if offsec > onsec:
             invert = True
             offsec, onsec = onsec, offsec
         if (offsec <= nowsec < onsec):
             if not invert:
                 mode = timeset
                 altspeed = True
             timeout = min(self.polltime, onsec - nowsec)
         elif nowsec < offsec:
             if invert:
                 mode = timeset
                 altspeed = True
             timeout = min(self.polltime, offsec - nowsec)
         else:
             if invert:
                 mode = timeset
                 altspeed = True
             timeout = min(self.polltime, 86400 - nowsec)
         if FanConf.usealtfanspeed.value and altspeed:
             speed = FanConf.altfanspeed.value
         if self.fan_speedcontrol is not None and not altspeed and standbyspeed:
             speed = FanConf.standbyfanspeed.value
     # check hdd settings (sleeping or temperature hdd's)
     elif mode == "off" and hddwatch != "none":
         hddcount = harddiskmanager.HDDCount()
         if hddcount:
             hddlist = []
             hdd_device = FanConf.hdddevice.value
             for hdd in harddiskmanager.HDDList():
                 if "pci" in hdd[1].phys_path or "ahci" in hdd[
                         1].phys_path or "sata" in hdd[1].phys_path:
                     if hdd_device == "all" or (hdd[1].dev_path
                                                == hdd_device):
                         hddlist.append(hdd)
             internal_hdd_count = len(hddlist)
             if internal_hdd_count:
                 if hddwatch == "sleep" and FanConf.hddsleep.value:
                     sleepcount = 0
                     for x in hddlist:
                         if isSleepStateDevice(x[1].dev_path) is True:
                             sleepcount += 1
                         else:
                             mode = "on"
                             set_altspeed = True
                     if sleepcount == internal_hdd_count:
                         mode = "off"
                         set_altspeed = False
                 elif hddwatch == "temp" and FanConf.hddtemp.value != 0:
                     hdd_temp_list = tempwatcher.getHddTempList()
                     found_hdd = False
                     for x in hddlist:
                         for d in hdd_temp_list:
                             hddtemp = hdd_temp_list[d]["temp"]
                             hddpath = hdd_temp_list[d]["path"]
                             if hdd_device == "all" or (hddpath
                                                        == x[1].dev_path):
                                 found_hdd = True
                                 if hddtemp >= FanConf.hddtemp.value:
                                     mode = "on"
                                     set_altspeed = True
                                 else:
                                     mode = "off"
                                     set_altspeed = False
                     if not found_hdd:
                         mode = "off"
                         set_altspeed = False
                 else:
                     timeout = 180
             else:
                 timeout = 180
         else:
             timeout = 180
     # check board temperature (cpu silicon or system)
     elif mode == "off" and syswatch != "none":
         if self.system_tempsensor is not None and syswatch == "system" and FanConf.systemtemp.value != 0:
             temp = getSystemTemp()
             if temp is not None:
                 if temp >= FanConf.systemtemp.value:
                     mode = "on"
                     set_altspeed = True
                     # adjust speed:
                     # - use initial speed when current sys temp > user specified value
                     # - increase speed til max. Max is reached when current sys temp = 2 * user specified value
                     #speed = min(FanConf.fanspeed.value + (255 - FanConf.fanspeed.value) * ((temp / FanConf.systemtemp.value) - 1), 255)
         elif self.cpu_tempsensor is not None and syswatch == "cpu" and FanConf.cputemp.value != 0:
             temp = getCPUtemp()
             if temp is not None:
                 if temp >= FanConf.cputemp.value:
                     mode = "on"
                     set_altspeed = True
     else:
         timeout = 180
     need_setspeed = False
     if FanConf.usealttime.value and set_altspeed:
         ts = localtime()
         nowsec = (ts.tm_hour * 3600) + (ts.tm_min * 60)
         offlist = FanConf.alt_timestart.value
         offsec = (offlist[0] * 3600) + (offlist[1] * 60)
         onlist = FanConf.alt_timeend.value
         onsec = (onlist[0] * 3600) + (onlist[1] * 60)
         invert = False
         if offsec > onsec:
             invert = True
             offsec, onsec = onsec, offsec
         if (offsec <= nowsec < onsec):
             if not invert:
                 need_setspeed = True
         elif nowsec < offsec:
             if invert:
                 need_setspeed = True
         else:
             if invert:
                 need_setspeed = True
         if need_setspeed:
             speed = FanConf.altfanspeed.value
     if self.fan_speedcontrol is not None and prev_mode == "off" and (
             hddwatch != "none" or syswatch != "none"):
         if not need_setspeed and set_altspeed and standbyspeed:
             speed = FanConf.standbyfanspeed.value
     if mode == "standby":
         if is_standby_box:
             self.applySettings("off", 0)
         else:
             self.applySettings("on", speed)
     else:
         if mode == "auto" and FanConf.alt_auto.value:
             if is_standby_box:
                 if self.session.nav.getRecordings():
                     mode = "on"
                 else:
                     mode = "off"
             else:
                 mode = "on"
         self.applySettings(mode, speed)
     self.timer.start(timeout * 1000, True)
Exemple #24
0
		elif config.usage.show_menupath.value == 'small':
			title = screentitle
			condtext = ""
			if self.menu_path and not self.menu_path.endswith(' / '):
				condtext = self.menu_path + " >"
			elif self.menu_path:
				condtext = self.menu_path[:-3] + " >"
			self["menu_path_compressed"] = StaticText(condtext)
			self.menu_path += screentitle + ' / '
		else:
			title = screentitle
			self["menu_path_compressed"] = StaticText("")
		Screen.setTitle(self, title)

		self.skinName = "HarddiskSelection" # For derived classes
		if harddiskmanager.HDDCount() == 0:
			tlist = [(_("no storage devices found"), 0)]
			self["hddlist"] = MenuList(tlist)
		else:
			self["hddlist"] = MenuList(harddiskmanager.HDDList())

		self["actions"] = ActionMap(["OkCancelActions"],
		{
			"ok": self.okbuttonClick,
			"cancel": self.close
		})

	def doIt(self, selection):
		self.session.openWithCallback(self.close, HarddiskSetup, selection,
			 action=selection.createInitializeJob,
<<<<<<< HEAD
Exemple #25
0
	def timerPoll(self):
		timeout = self.polltime
		FanConf = config.plugins.FanSetup
		mode = FanConf.mode.value
		timeset = FanConf.timeset.value

		# check time settings and if need change fan mode
		if mode != "off" and timeset != "none":
			ts = localtime()
			nowsec = (ts.tm_hour * 3600) + (ts.tm_min * 60)
			offlist= config.plugins.FanSetup.timestartoff.value
			offsec = (offlist[0] * 3600) + (offlist[1] * 60)
			onlist = config.plugins.FanSetup.timeendoff.value
			onsec = (onlist[0] * 3600) + (onlist[1] * 60)
			invert = False
			if offsec > onsec:
				invert = True
				offsec, onsec = onsec, offsec
			if (offsec <= nowsec < onsec):
				if not invert:
					mode = timeset
				timeout = min(self.polltime, onsec - nowsec)
			elif nowsec < offsec:
				if invert:
					mode = timeset
				timeout = min(self.polltime, offsec - nowsec)
			else:
				if invert:
					mode = timeset
				timeout = min(self.polltime, 86400 - nowsec)

		# check hdd settings (sleeping and temperature hdd's)
		if FanConf.hddwatch.value != "none" and mode == "off":
			hddcount = harddiskmanager.HDDCount()
			if hddcount:
				if FanConf.hddwatch.value == "sleep" and FanConf.hddsleep.value is True:
					sleepcount = 0
					hddlist = harddiskmanager.HDDList()
					for x in range (hddcount):
						if hddlist[x][1].isSleeping():
							sleepcount += 1
						else:
							mode = "on"
					if sleepcount == hddcount:
						mode = "off"
				elif FanConf.hddwatch.value == "temp" and FanConf.hddtemp.value != 0:
					hddlist = harddiskmanager.HDDList()
					for hdd in hddlist:
						if not hdd[1].isSleeping():
							disk, hddtemp = getTempForDevice(hdd[1].getDeviceDir())
							if hddtemp >= FanConf.hddtemp.value:
								mode = "on"
							else:
								mode = "off"
						else:
							mode = "off"

		speed = FanConf.fanspeed.value
		if FanConf.systempwatch.value == "on":
			temp = getSysTemp()
			if temp is not None:
				if temp >= FanConf.systemtemp.value:
					mode = "on"
					# adjust speed: 
					# - use initial speed when current sys temp > user specified value
					# - increase speed til max. Max is reached when current sys temp = 2 * user specified value
					speed = min(FanConf.fanspeed.value + (255 - FanConf.fanspeed.value) * ((temp / FanConf.systemtemp.value) - 1), 255)

		if mode == "standby":
			from Screens.Standby import inStandby
			if inStandby:
				self.applySettings("off", 0)
			else:
				self.applySettings("on", speed)
		else:
			self.applySettings(mode, speed)
		self.timer.start(timeout * 1000, True)
Exemple #26
0
	def isInternalHDD(self):
		if harddiskmanager.HDDCount():
			for hdd in harddiskmanager.HDDList():
				if "pci" in hdd[1].phys_path or "ahci" in hdd[1].phys_path:
					return hdd
		return None
Exemple #27
0
    def getConfigListValues(self):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
            return
        if self.timerentry_justplay.value == 'record':
            if not harddiskmanager.inside_mountpoint(
                    self.timerentry_dirname.value):
                if harddiskmanager.HDDCount(
                ) and not harddiskmanager.HDDEnabledCount():
                    self.session.open(MessageBox, _("Unconfigured storage devices found!") + "\n" \
                     + _("Please make sure to set up your storage devices with the improved storage management in menu -> setup -> system -> storage devices."), MessageBox.TYPE_ERROR)
                    return
                elif harddiskmanager.HDDEnabledCount(
                ) and defaultStorageDevice() == "<undefined>":
                    self.session.open(MessageBox, _("No default storage device found!") + "\n" \
                     + _("Please make sure to set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
                    return
                elif harddiskmanager.HDDEnabledCount(
                ) and defaultStorageDevice() != "<undefined>":
                    part = harddiskmanager.getDefaultStorageDevicebyUUID(
                        defaultStorageDevice())
                    if part is None:
                        self.session.open(MessageBox, _("Default storage device is not available!") + "\n" \
                         + _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
                        return
                else:
                    self.session.open(
                        MessageBox,
                        _("Recording destination for this timer does not exists."
                          ), MessageBox.TYPE_ERROR)
                    return

        self.timer.name = self.timerentry_name.value
        self.timer.description = self.timerentry_description.value
        self.timer.justplay = self.timerentry_justplay.value == "zap"
        if self.timerentry_justplay.value == "zap":
            if not self.timerentry_showendtime.value:
                self.timerentry_endtime.value = self.timerentry_starttime.value

        self.timer.resetRepeated()
        self.timer.afterEvent = {
            "nothing": AFTEREVENT.NONE,
            "deepstandby": AFTEREVENT.DEEPSTANDBY,
            "standby": AFTEREVENT.STANDBY,
            "auto": AFTEREVENT.AUTO
        }[self.timerentry_afterevent.value]
        self.timer.service_ref = self.timerentry_service_ref
        self.timer.tags = self.timerentry_tags

        if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(
        ):
            self.timer.dirname = self.timerentry_dirname.value
            config.movielist.last_timer_videodir.value = self.timer.dirname
            config.movielist.last_timer_videodir.save()

        if self.timerentry_type.value == "once":
            self.timer.begin, self.timer.end = self.getBeginEnd()
        if self.timerentry_type.value == "repeated":
            if self.timerentry_repeated.value == "daily":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "weekly":
                self.timer.setRepeated(self.timerentry_weekday.index)

            if self.timerentry_repeated.value == "weekdays":
                for x in (0, 1, 2, 3, 4):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "user":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if self.timerentry_day[x].value:
                        self.timer.setRepeated(x)

            self.timer.repeatedbegindate = self.getTimestamp(
                self.timerentry_repeatedbegindate.value,
                self.timerentry_starttime.value)
            if self.timer.repeated:
                self.timer.begin = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_endtime.value)
            else:
                self.timer.begin = self.getTimestamp(
                    time.time(), self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    time.time(), self.timerentry_endtime.value)

            # when a timer end is set before the start, add 1 day
            if self.timer.end < self.timer.begin:
                self.timer.end += 86400
	def CheckElektro(self):
		# first set the next wakeuptime - it would be much better to call that function on sleep. This will be a todo!
		self.setNextWakeuptime()

		#convert to seconds
		time_s = self.getTime()
		ltime = localtime()
		if config.plugins.elektro.profile.value == "1":
			config_wakeup = config.plugins.elektro.wakeup
			config_sleep = config.plugins.elektro.sleep
			config_nextday = config.plugins.elektro.nextday
		else:
			config_wakeup = config.plugins.elektro.wakeup2
			config_sleep = config.plugins.elektro.sleep2
			config_nextday = config.plugins.elektro.nextday2

		#Which day is it? The next day starts at nextday
		if debug:
			print pluginPrintname, "wday 1:", str(ltime.tm_wday)
		if time_s < self.clkToTime(config_nextday):
			day = (ltime.tm_wday - 1) % 7
		else:
			day = ltime.tm_wday
		if debug:
			print pluginPrintname, "wday 2:", str(day)

		#Let's get the day
		wakeuptime = lwakeuptime = self.clkToTime(config_wakeup[day])
		sleeptime = lsleeptime = self.clkToTime(config_sleep[day])
		ltime_s = time_s

		print pluginPrintname, "Profile:", config.plugins.elektro.profile.value
		print pluginPrintname, "Nextday:", self.getPrintTime(self.clkToTime(config.plugins.elektro.nextday))
		print pluginPrintname, "Current time:", self.getPrintTime(time_s)
		print pluginPrintname, "Wakeup time:", self.getPrintTime(wakeuptime)
		print pluginPrintname, "Sleep time:", self.getPrintTime(sleeptime)

		#convert into relative Times
		time_s = self.getReltime(time_s)
		wakeuptime  = self.getReltime(wakeuptime)
		sleeptime = self.getReltime(sleeptime)

		if debug:
			print pluginPrintname, "Current Rel-time:", self.getPrintTime(time_s)
			print pluginPrintname, "Wakeup Rel-time:", self.getPrintTime(wakeuptime)
			print pluginPrintname, "Sleep Rel-time:", self.getPrintTime(sleeptime)

		#let's see if we should be sleeping
		trysleep = False
		if time_s < (wakeuptime - elektroShutdownThreshold): # Wakeup is in the future -> sleep!
			trysleep = True
			print pluginPrintname, "Wakeup!", self.getPrintTime(ltime_s), " <", self.getPrintTime(lwakeuptime)
		if sleeptime < time_s : #Sleep is in the past -> sleep!
			trysleep = True
			print pluginPrintname, "try Sleep:", self.getPrintTime(lsleeptime), " <", self.getPrintTime(ltime_s)

		#We are not tying to go to sleep anymore -> maybe go to sleep again the next time
		if trysleep == False:
			print pluginPrintname, "don't try sleep -> maybe go to sleep again the next time"
			self.dontsleep = False

		#The User aborted to got to sleep -> Don't go to sleep.
		if self.dontsleep:
			print pluginPrintname, "don't sleep - User aborted to got to sleep"
			trysleep = False

		# If we are in holydaymode we should try to got to sleep anyway
		# This should be set after self.dontsleep has been handled
		if config.plugins.elektro.holiday.value:
			print pluginPrintname, "sleep - we are in holiday mode"
			trysleep = True

		# We are not enabled -> Dont go to sleep (This could have been catched earlier!)
		if config.plugins.elektro.enable.value == False:
			print pluginPrintname, "don't sleep - Elektro not activated"
			trysleep = False

		# Only go to sleep if we are in standby or sleep is forced by settings
		if trysleep == True and not ((Standby.inStandby) or (config.plugins.elektro.force.value == True)):
			print pluginPrintname, "don't sleep - not in standby or sleep not forced by settings"
			trysleep = False

		# wakeuptime coming up in a short while - Sven H
		# avoid deepstandby on recordtimer-end with auto-afterevent, if wakeuptime after recordstart
		if wakeuptime > 0 and (wakeuptime - time_s) < elektroShutdownThreshold and NavigationInstance.instance.wasTimerWakeup() and Screens.Standby.inStandby and config.misc.standbyCounter.value == 1 and config.misc.isNextRecordTimerAfterEventActionAuto.value:
			print pluginPrintname, "wakeuptime coming up in a short while: set isNextRecordTimerAfterEventActionAuto to False"
			config.misc.isNextRecordTimerAfterEventActionAuto.value = False

		# No Sleep while recording
		if trysleep == True and self.session.nav.RecordTimer.isRecording():
			print pluginPrintname, "don't sleep - current recording"
			trysleep = False

		# No Sleep on Online IPs - joergm6
		if trysleep == True and config.plugins.elektro.IPenable.value == True:
			for i in range(10):
				ip = "%d.%d.%d.%d" % tuple(config.plugins.elektro.ip[i].value)
				if ip != "0.0.0.0":
					if ping.doOne(ip,0.1) != None:
						print pluginPrintname, "don't sleep - ip online:", ip
						trysleep = False
						break

		# No Sleep on HDD running
		if trysleep == True and (config.plugins.elektro.hddsleep.value == True) and (harddiskmanager.HDDCount() > 0):
			hddlist = harddiskmanager.HDDList()
			#new code by Sven H
			for hdd in hddlist:
				#print "[Elektro] ", hdd[0], hdd[1].bus_description(), hdd[1].isSleeping()
				if hdd[1].bus_description() == "SATA" and not hdd[1].isSleeping():
					print pluginPrintname, "don't sleep - HDD is active:", hdd[0]
					trysleep = False
			#old code by joergm6
			#if hddlist[0][1].model().startswith("ATA"):
			#	if not hddlist[0][1].isSleeping():
			#		print pluginPrintname, "HDD is active"
			#		trysleep = False

		# No Sleep on network activity - betonme
		if trysleep == True and (config.plugins.elektro.netsleep.value == True) and (harddiskmanager.HDDCount() > 0):
			with open("/proc/net/tcp", 'r') as f:
				lines = f.readlines()
				lines.pop(0)
				for line in lines:
					content = line.split()
					if content[3] == "01":
						# Connection established
						print pluginPrintname, "don't sleep - tcp-Connection established"
						trysleep = False
						break
			with open("/proc/net/udp", 'r') as f:
				lines = f.readlines()
				lines.pop(0)
				for line in lines:
					content = line.split()
					if content[3] == "01":
						# Connection established
						print pluginPrintname, "don't sleep - udp-Connection established"
						trysleep = False
						break

		# No Sleep on nfs-read activity - Sven H
		if trysleep == True and (config.plugins.elektro.nfssleep.value == True):
			with open("/proc/net/rpc/nfsd", 'r') as f:
				lines = f.readlines()
				for line in lines:
					content = line.split()
					if content[0] == "io":
						current_nfsread = content[1]
						#print pluginPrintname, "nfs-read activity - last, current", self.last_nfsread, current_nfsread
						if (current_nfsread != self.last_nfsread):
							print pluginPrintname, "don't sleep because current nfs-read activity"
							trysleep = False
						self.last_nfsread = current_nfsread
						break

		# Will there be a recording in a short while?
		nextRecTime = self.session.nav.RecordTimer.getNextRecordingTime()
		if trysleep == True and (nextRecTime > 0) and (nextRecTime - (int)(time()) <  elektroShutdownThreshold):
			print pluginPrintname, "don't sleep - there be a recording in a short while"
			trysleep = False

		# Looks like there really is a reason to go to sleep -> Lets try it!
		if trysleep:
			#self.();
			try:
				self.session.openWithCallback(self.DoElektroSleep, MessageBox, _("Go to sleep now?"),type = MessageBox.TYPE_YESNO,timeout = 60)
			except:
				#reset the timer and try again
				self.TimerSleep.startLongTimer(elektrostarttime)

		#set Timer, which calls this function again.
		self.TimerSleep.startLongTimer(elektrostarttime)