frobar: Display temperature for other CPU types

This commit is contained in:
Geoffrey Frogeye 2024-06-17 19:30:48 +02:00
parent a3fcaf9d27
commit d6d3df65df
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -144,16 +144,20 @@ class RamProvider(AlertingSection, PeriodicUpdater):
class TemperatureProvider(AlertingSection, PeriodicUpdater): class TemperatureProvider(AlertingSection, PeriodicUpdater):
NUMBER_STATES = 2 NUMBER_STATES = 2
RAMP = "" RAMP = ""
MAIN_TEMPS = ["coretemp", "amdgpu", "cpu_thermal"]
# For Intel, AMD and ARM respectively.
def fetcher(self): def fetcher(self):
allTemp = psutil.sensors_temperatures() allTemp = psutil.sensors_temperatures()
if "coretemp" not in allTemp: for main in self.MAIN_TEMPS:
# TODO Opti Remove interval if main in allTemp:
return "" break
temp = allTemp["coretemp"][0] else:
return "?"
temp = allTemp[main][0]
self.warningThresold = temp.high self.warningThresold = temp.high or 90.0
self.dangerThresold = temp.critical self.dangerThresold = temp.critical or 100.0
self.updateLevel(temp.current) self.updateLevel(temp.current)
self.icon = Section.ramp(temp.current / temp.high, self.RAMP) self.icon = Section.ramp(temp.current / temp.high, self.RAMP)