From c5297bd35882eec7fc6702185e177a98724551be Mon Sep 17 00:00:00 2001 From: Hristo Date: Mon, 24 Mar 2025 18:25:14 +0200 Subject: [PATCH] remove comments --- src/rpi-cpu2mqtt.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rpi-cpu2mqtt.py b/src/rpi-cpu2mqtt.py index c003589..44350e1 100644 --- a/src/rpi-cpu2mqtt.py +++ b/src/rpi-cpu2mqtt.py @@ -161,12 +161,10 @@ def read_ext_sensors(): def check_cpu_temp(): try: - # Get temperature readings from psutil temps = psutil.sensors_temperatures() if not temps: raise ValueError("No temperature sensors found.") - # Check for Raspberry Pi (cpu_thermal) or x86 (coretemp) if "cpu_thermal" in temps: cpu_temp = temps["cpu_thermal"][0].current elif "coretemp" in temps: @@ -174,7 +172,7 @@ def check_cpu_temp(): else: 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: print(f"Error reading CPU temperature: {e}") return None if config.use_availability else 0