remove comments

This commit is contained in:
Hristo
2025-03-24 18:25:14 +02:00
parent f5cc950ee3
commit c5297bd358

View File

@@ -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