def CurrTemp(self): m1 = 0.1 m2 = 0.1 ti = [0,0,0,0,0,0,0,0,0,0] templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) tempcount = len(templist) for count in range(tempcount): tt = sensors.getSensorValue(count) ti[count] = tt if m1 < tt: mi = count m1 = tt for count in range(tempcount): if m2 < ti[count] and count != mi: m2 = ti[count] if m2 == 0.1: m2 = m1 return (m1 + m2) / 2.0
def FCdata(): global DataMinute if strftime("%M")!=DataMinute and config.plugins.FanControl.EnableDataLog.value: DataMinute = strftime("%M") if Free(config.plugins.FanControl.LogPath.value): try: f = open(config.plugins.FanControl.LogPath.value + "FC2data.csv","a") try: f.write(strftime("%Y.%m.%d %H:%M")) for count in range(6): f.write(";" + str(FC2werte[count]).replace(".",_("."))) templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) tempcount = len(templist) for count in range(tempcount): f.write(";" + str(sensors.getSensorValue(count))) f.write("\r\n") finally: f.close() except IOError: FC2Log.append(strftime("%H:%M:%S ") + "Event-Log-Error")
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: 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)
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)
def render(self, req): req.setHeader('Content-type', 'text/html') req.setHeader('charset', 'UTF-8') """ rendering server response """ command = req.args.get("cmd", None) html = "<html>" html += "<head>\n" html += "<meta http-equiv=\"Content-Language\" content=\"de\">\n" html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n" html += "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n" html += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n" html += "<meta http-equiv=\"expires\" content=\"0\">\n" html += "<meta http-equiv=\"refresh\" content=\"20\">\n" html += "<title>Fan Control 2 - Info</title>\n" html += "</head>" html += "<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n" html += "<form method=\"POST\" action=\"--WEBBOT-SELF--\">\n" html += "<table border=\"1\" width=\"500\" bordercolorlight=\"#000000\" bordercolordark=\"#000000\" cellspacing=\"1\"><tr><td bgcolor=\"#000000\" width=\"200\">\n" html += "<p align=\"center\"><img border=\"0\" src=\"/fancontrol/FC2dreambox.png\" width=\"181\" height=\"10\">\n" html += "<font color=\"#FFFFFF\"><BR><b>Fan Control 2 - Info</b></font></p>\n" html += "</td><td bgcolor=\"#000000\">\n" html += "<p align=\"right\">" html += BoxStatus() if os.path.exists(config.plugins.FanControl.LogPath.value + "FC2data.csv"): html += "<a href=\"/fancontrol/chart\"><img border=\"0\" src=\"/fancontrol/FC2Chart.png\" width=\"100\" height=\"40\"></a>\n" html += "<a href=\"/fancontrol/log\"><img border=\"0\" src=\"/fancontrol/FC2Setup.png\" width=\"100\" height=\"40\"></a></td></tr></table>\n" html += "<table border=\"1\" width=\"500\" id=\"table1\">\n" html += "<tr>\n" html += "<td>%s: <b><font color=\"#FFCC00\">%4.1f °C</font></b></td>\n" % ( _("Temperature"), FC2werte[0]) html += "<td>%s: <font color=\"#FFCC00\"><b>%4d rpm</b></font></td>\n" % ( _("Speed"), FC2werte[1]) html += "<td>%s: <font color=\"#FFCC00\"><b>%03d</b></font></td>\n" % ( _("Voltage"), FC2werte[2]) html += "<td>PWM: <font color=\"#FFCC00\"><b>%03d</b></font></td>\n" % FC2werte[ 3] html += "</tr>\n" html += "</table>\n" html += "<table border=\"1\" width=\"500\">\n" html += "<tr>\n" html += "<td>%s °C</td>\n" % _("Sensors") templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) tempcount = len(templist) for count in range(tempcount): if sensors.getSensorName(count) == "undefined": N = TempName[count] else: N = sensors.getSensorName(count) html += "<td><font color=\"#FFCC00\" title=\"%s\">%d</font></td>" % ( N, sensors.getSensorValue(count)) if FC2werte[4] > 0: html += "<td><font size=\"1\">HDD </font><font color=\"#FFCC00\">%d</font></td>\n" % FC2werte[ 4] html += "</tr>\n" html += "</table>\n" html += "<table border=\"1\" width=\"500\">\n" html += "<tr>\n" for count in range(0, 12): tmp = ("<BR>-" if FC2stunde[count] == "-" else FC2stunde[count]) html += "<td><p align=\"center\"><font size=\"1\">%02d:00<br><font color=\"#FFCC00\">%s</font></font></td>\n" % ( count, tmp) html += "</tr><tr>\n" for count in range(12, 24): tmp = ("<BR>-" if FC2stunde[count] == "-" else FC2stunde[count]) html += "<td><p align=\"center\"><font size=\"1\">%02d:00<br><font color=\"#FFCC00\">%s</font></font></td>\n" % ( count, tmp) html += "</tr></table>\n" html += "<script type=\"text/javascript\">\n" html += "function doLogWrite() {\n" html += "var iFrameWin = window.myIFrameName;\n" html += "iFrameWin.document.write('<html><head><title>FC2 Log Window</title></head><body bgcolor=\"#D3D3D3\">');\n" html += "iFrameWin.document.write('<font size=\"-1\">');\n" for L in FC2Log: html += "iFrameWin.document.write('" + L + "<br>');\n" html += "iFrameWin.document.write('</font>');\n" html += "iFrameWin.document.write('</body></html>');\n" html += "iFrameWin.document.close();\n" html += "}\n" html += "</script>\n" html += "<iframe id=\"myIFrameId\" name=\"myIFrameName\" width=\"500\" height=\"320\" marginwidth=\"5\" vspace=\"2\" marginheight=\"5\" frameborder=\"1\" scrolling=\"auto\"></iframe>\n" html += "<script>doLogWrite();\n" html += "myIFrameName.document.body.scrollTop = myIFrameName.document.body.scrollHeight*100;\n" html += "</script>\n" html += "<table border=\"1\" width=\"500\">\n" html += "<tr>\n" html += "<td>Version: %s </td>\n" % Version html += "<td>Settings: %s-%s °C</td>\n" % ( config.plugins.FanControl.temp.value, config.plugins.FanControl.tempmax.value) html += "<td>%s-%s rpm</td>\n" % ( config.plugins.FanControl.minRPM.value, config.plugins.FanControl.maxRPM.value) html += "</tr>\n" html += "</table>\n" html += "</body>\n" html += "</html>\n" html += "</form>\n" return html
def render(self, req): req.setHeader('Content-type', 'text/html') req.setHeader('charset', 'UTF-8') """ rendering server response """ command = req.args.get("cmd",None) html = "<html>" html += "<head>\n" html += "<meta http-equiv=\"Content-Language\" content=\"de\">\n" html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n" html += "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n" html += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n" html += "<meta http-equiv=\"expires\" content=\"0\">\n" html += "<meta http-equiv=\"refresh\" content=\"20\">\n" html += "<title>Fan Control 2 - Info</title>\n" html += "</head>" html += "<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n" html += "<form method=\"POST\" action=\"--WEBBOT-SELF--\">\n" html += "<table border=\"1\" width=\"500\" bordercolorlight=\"#000000\" bordercolordark=\"#000000\" cellspacing=\"1\"><tr><td bgcolor=\"#000000\" width=\"200\">\n" html += "<p align=\"center\"><img border=\"0\" src=\"/fancontrol/FC2dreambox.png\" width=\"181\" height=\"10\">\n" html += "<font color=\"#FFFFFF\"><BR><b>Fan Control 2 - Info</b></font></p>\n" html += "</td><td bgcolor=\"#000000\">\n" html += "<p align=\"right\">" html += BoxStatus() if os.path.exists(config.plugins.FanControl.LogPath.value + "FC2data.csv"): html += "<a href=\"/fancontrol/chart\"><img border=\"0\" src=\"/fancontrol/FC2Chart.png\" width=\"100\" height=\"40\"></a>\n" html += "<a href=\"/fancontrol/log\"><img border=\"0\" src=\"/fancontrol/FC2Setup.png\" width=\"100\" height=\"40\"></a></td></tr></table>\n" html += "<table border=\"1\" width=\"500\" id=\"table1\">\n" html += "<tr>\n" html += "<td>%s: <b><font color=\"#FFCC00\">%4.1f °C</font></b></td>\n" % (_("Temperature"),FC2werte[0]) html += "<td>%s: <font color=\"#FFCC00\"><b>%4d rpm</b></font></td>\n" % (_("Speed"),FC2werte[1]) html += "<td>%s: <font color=\"#FFCC00\"><b>%03d</b></font></td>\n" % (_("Voltage"),FC2werte[2]) html += "<td>PWM: <font color=\"#FFCC00\"><b>%03d</b></font></td>\n" % FC2werte[3] html += "</tr>\n" html += "</table>\n" html += "<table border=\"1\" width=\"500\">\n" html += "<tr>\n" html += "<td>%s °C</td>\n" % _("Sensors") templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) tempcount = len(templist) for count in range(tempcount): if sensors.getSensorName(count) == "undefined": N = TempName[count] else: N = sensors.getSensorName(count) html += "<td><font color=\"#FFCC00\" title=\"%s\">%d</font></td>" % (N,sensors.getSensorValue(count)) if FC2werte[4] > 0: html += "<td><font size=\"1\">HDD </font><font color=\"#FFCC00\">%d</font></td>\n" % FC2werte[4] html += "</tr>\n" html += "</table>\n" html += "<table border=\"1\" width=\"500\">\n" html += "<tr>\n" for count in range(0,12): tmp = ("<BR>-" if FC2stunde[count] == "-" else FC2stunde[count]) html +="<td><p align=\"center\"><font size=\"1\">%02d:00<br><font color=\"#FFCC00\">%s</font></font></td>\n" % (count,tmp) html += "</tr><tr>\n" for count in range(12,24): tmp = ("<BR>-" if FC2stunde[count] == "-" else FC2stunde[count]) html +="<td><p align=\"center\"><font size=\"1\">%02d:00<br><font color=\"#FFCC00\">%s</font></font></td>\n" % (count,tmp) html += "</tr></table>\n" html += "<script type=\"text/javascript\">\n" html += "function doLogWrite() {\n" html += "var iFrameWin = window.myIFrameName;\n" html += "iFrameWin.document.write('<html><head><title>FC2 Log Window</title></head><body bgcolor=\"#D3D3D3\">');\n" html += "iFrameWin.document.write('<font size=\"-1\">');\n" for L in FC2Log: html += "iFrameWin.document.write('" + L + "<br>');\n" html += "iFrameWin.document.write('</font>');\n" html += "iFrameWin.document.write('</body></html>');\n" html += "iFrameWin.document.close();\n" html += "}\n" html += "</script>\n" html += "<iframe id=\"myIFrameId\" name=\"myIFrameName\" width=\"500\" height=\"320\" marginwidth=\"5\" vspace=\"2\" marginheight=\"5\" frameborder=\"1\" scrolling=\"auto\"></iframe>\n" html += "<script>doLogWrite();\n" html += "myIFrameName.document.body.scrollTop = myIFrameName.document.body.scrollHeight*100;\n" html += "</script>\n" html += "<table border=\"1\" width=\"500\">\n" html += "<tr>\n" html += "<td>Version: %s </td>\n" % Version html += "<td>Settings: %s-%s °C</td>\n" % (config.plugins.FanControl.temp.value,config.plugins.FanControl.tempmax.value) html += "<td>%s-%s rpm</td>\n" % (config.plugins.FanControl.minRPM.value,config.plugins.FanControl.maxRPM.value) html += "</tr>\n" html += "</table>\n" html += "</body>\n" html += "</html>\n" html += "</form>\n" return html