Fix NVMe temperature parsing bug for values > 99°C

Replace digits[:2] truncation with regex extraction of complete number.
Previously "123°C" would be parsed as 12 instead of 123.

Resolves #8

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 12:56:37 -05:00
parent 0559f2d668
commit c7309663de

View File

@@ -2574,10 +2574,10 @@ class SystemHealthMonitor:
temp_str = line.split(':')[1].strip() if ':' in line else line.strip()
logger.debug(f"Raw temperature string: {temp_str}")
# Extract first temperature value more safely
digits = ''.join(c for c in temp_str if c.isdigit())
if len(digits) >= 2:
temp_value = int(digits[:2])
# Extract the first complete number from temperature string
temp_match = re.search(r'(\d+)', temp_str)
if temp_match:
temp_value = int(temp_match.group(1))
logger.debug(f"Parsed temperature value: {temp_value}")
# Set both temperature fields