diff --git a/app.py b/app.py index 90203e6..64b22c5 100644 --- a/app.py +++ b/app.py @@ -362,7 +362,8 @@ def smart_temperature(device): # Seagate and similar drives often expose both Airflow_Temperature # and Temperature_Celsius. Prefer the latter because it is the # physical drive temperature shown by the usual terminal command. - ordered = [line for line in lines if re.search(r"Temperature_Celsius|Drive_Temperature|Current Drive Temperature", line, re.IGNORECASE)] + ordered = [line for line in lines if re.search(r"Current Drive Temperature|Drive Temperature|^\s*Temperature:\s*", line, re.IGNORECASE)] + ordered += [line for line in lines if line not in ordered and re.search(r"Temperature_Celsius", line, re.IGNORECASE)] ordered += [line for line in lines if line not in ordered and re.search(r"temperature|airflow", line, re.IGNORECASE)] for line in ordered: explicit = re.search(r"(\d{1,3})\s*(?:°\s*C|Celsius|degrees?\s*C)\b", line, re.IGNORECASE) @@ -375,8 +376,8 @@ def smart_temperature(device): return None for command in ( - ["smartctl", "-A", "-d", "sat", smart_device], ["smartctl", "-x", "-d", "sat", smart_device], + ["smartctl", "-A", "-d", "sat", smart_device], ["smartctl", "-A", smart_device], ["smartctl", "-x", smart_device], ):