Update flask_server.py

This commit is contained in:
MacRimi
2025-10-14 22:47:13 +02:00
parent e476df5e7d
commit 998bfa0656

View File

@@ -1000,8 +1000,6 @@ def get_smart_data(disk_name):
smart_data['crc_errors'] = int(raw_value)
print(f"[v0] CRC Errors: {smart_data['crc_errors']}")
elif attr_id == '233': # Media_Wearout_Indicator (Intel/Samsung SSD)
# Valor normalizado: 100 = nuevo, 0 = gastado
# Invertimos para mostrar desgaste: 0% = nuevo, 100% = gastado
normalized_value = int(parts[3]) if len(parts) > 3 else 100
smart_data['media_wearout_indicator'] = 100 - normalized_value
print(f"[v0] Media Wearout Indicator (ID 233): {smart_data['media_wearout_indicator']}% used")
@@ -1032,27 +1030,6 @@ def get_smart_data(disk_name):
except (ValueError, IndexError) as e:
print(f"[v0] Error parsing attribute line '{line}': {e}")
continue
elif attr_id == 233: # Media_Wearout_Indicator (Intel/Samsung SSD)
# Valor normalizado: 100 = nuevo, 0 = gastado
# Invertimos para mostrar desgaste: 0% = nuevo, 100% = gastado
smart_data['media_wearout_indicator'] = 100 - normalized_value
print(f"[v0] Media Wearout Indicator (ID 233): {smart_data['media_wearout_indicator']}% used")
elif attr_id == 177: # Wear_Leveling_Count
# Valor normalizado: 100 = nuevo, 0 = gastado
smart_data['wear_leveling_count'] = 100 - normalized_value
print(f"[v0] Wear Leveling Count (ID 177): {smart_data['wear_leveling_count']}% used")
elif attr_id == 202: # Percentage_Lifetime_Remain (algunos fabricantes)
# Valor normalizado: 100 = nuevo, 0 = gastado
smart_data['ssd_life_left'] = normalized_value
print(f"[v0] SSD Life Left (ID 202): {smart_data['ssd_life_left']}%")
elif attr_id == 231: # SSD_Life_Left (algunos fabricantes)
smart_data['ssd_life_left'] = normalized_value
print(f"[v0] SSD Life Left (ID 231): {smart_data['ssd_life_left']}%")
elif attr_id == 241: # Total_LBAs_Written
# Convertir a GB (raw_value es en sectores de 512 bytes)
total_gb = (raw_value * 512) / (1024 * 1024 * 1024)
smart_data['total_lbas_written'] = round(total_gb, 2)
print(f"[v0] Total LBAs Written (ID 241): {smart_data['total_lbas_written']} GB")
# If we got complete data, break
if smart_data['model'] != 'Unknown' and smart_data['serial'] != 'Unknown':