remove comments
This commit is contained in:
@@ -161,12 +161,10 @@ def read_ext_sensors():
|
|||||||
|
|
||||||
def check_cpu_temp():
|
def check_cpu_temp():
|
||||||
try:
|
try:
|
||||||
# Get temperature readings from psutil
|
|
||||||
temps = psutil.sensors_temperatures()
|
temps = psutil.sensors_temperatures()
|
||||||
if not temps:
|
if not temps:
|
||||||
raise ValueError("No temperature sensors found.")
|
raise ValueError("No temperature sensors found.")
|
||||||
|
|
||||||
# Check for Raspberry Pi (cpu_thermal) or x86 (coretemp)
|
|
||||||
if "cpu_thermal" in temps:
|
if "cpu_thermal" in temps:
|
||||||
cpu_temp = temps["cpu_thermal"][0].current
|
cpu_temp = temps["cpu_thermal"][0].current
|
||||||
elif "coretemp" in temps:
|
elif "coretemp" in temps:
|
||||||
@@ -174,7 +172,7 @@ def check_cpu_temp():
|
|||||||
else:
|
else:
|
||||||
raise ValueError("CPU temperature sensor not found.")
|
raise ValueError("CPU temperature sensor not found.")
|
||||||
|
|
||||||
return round(cpu_temp, 2) # Return temperature rounded to 2 decimal places
|
return round(cpu_temp, 2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error reading CPU temperature: {e}")
|
print(f"Error reading CPU temperature: {e}")
|
||||||
return None if config.use_availability else 0
|
return None if config.use_availability else 0
|
||||||
|
|||||||
Reference in New Issue
Block a user