Skip to content

Commit

Permalink
Rounded down CPU temp and Freq
Browse files Browse the repository at this point in the history
  • Loading branch information
sco01 committed Oct 13, 2019
1 parent e2b5a44 commit 562f372
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions octoprint_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def psUtilGetStats(self):
temp_sum = 0
thermal = psutil.sensors_temperatures(fahrenheit=False)
if "cpu-thermal" in thermal:
self.cpu_temp = round((thermal["cpu-thermal"][0][1]))
self.cpu_temp = int(round((thermal["cpu-thermal"][0][1])))
elif 'coretemp' in thermal:
for temp in range(0,len(thermal["coretemp"]),1):
temp_sum = temp_sum+thermal["coretemp"][temp][1]
self.cpu_temp = temp_sum / len(thermal["coretemp"])
self.cpu_temp = int(round(temp_sum / len(thermal["coretemp"])))
self.cpu_percent = str(psutil.cpu_percent(interval=None, percpu=False))
self.cpu_freq = str(psutil.cpu_freq(percpu=False).current)
self.cpu_freq = str(int(round(psutil.cpu_freq(percpu=False).current, 0)))
self.virtual_memory_percent = str(psutil.virtual_memory().percent)
self.disk_usage = str(psutil.disk_usage("/").percent)

Expand Down

0 comments on commit 562f372

Please sign in to comment.