Skip to content

Commit

Permalink
Pick cpu thermal device from sysfs instead of hardcodingi, #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Carter committed Dec 9, 2021
1 parent 10f85da commit a716570
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion overwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
except ImportError:
pass

# Pick up the principal CPU thermal zone from the sysfs class
with open('/sys/class/thermal/thermal_zone0/type','r') as cpu_temp_zone:
cpu_thermal_device = cpu_temp_zone.read().strip().replace('-','_')

#
# Import, setup and return hardware drivers, or 'None' if setup fails

Expand Down Expand Up @@ -183,7 +187,7 @@ def button_interrupt(*_):
def update_system():
'''Get current environmental and system data, called on a schedule
'''
data['sys-temp'] = psutil.sensors_temperatures()["cpu_thermal"][0].current
data['sys-temp'] = psutil.sensors_temperatures()[cpu_thermal_device][0].current
data['sys-load'] = psutil.getloadavg()[0]
data["sys-freq"] = psutil.cpu_freq().current
data['sys-mem'] = psutil.virtual_memory().percent
Expand Down

0 comments on commit a716570

Please sign in to comment.