Update flask_server.py

This commit is contained in:
MacRimi
2025-10-14 22:36:50 +02:00
parent 83a3601cdb
commit e476df5e7d

View File

@@ -873,9 +873,14 @@ def get_smart_data(disk_name):
print(f"[v0] SSD Life Left (ID 231): {smart_data['ssd_life_left']}%") print(f"[v0] SSD Life Left (ID 231): {smart_data['ssd_life_left']}%")
elif attr_id == '241': # Total_LBAs_Written elif attr_id == '241': # Total_LBAs_Written
# Convertir a GB (raw_value es en sectores de 512 bytes) # Convertir a GB (raw_value es en sectores de 512 bytes)
total_gb = (raw_value * 512) / (1024 * 1024 * 1024) # Corrected the conversion for Total_LBAs_Written (ID 241)
try:
raw_int = int(raw_value.replace(',', ''))
total_gb = (raw_int * 512) / (1024 * 1024 * 1024)
smart_data['total_lbas_written'] = round(total_gb, 2) smart_data['total_lbas_written'] = round(total_gb, 2)
print(f"[v0] Total LBAs Written (ID 241): {smart_data['total_lbas_written']} GB") print(f"[v0] Total LBAs Written (ID 241): {smart_data['total_lbas_written']} GB")
except ValueError:
pass
# If we got good data, break out of the loop # If we got good data, break out of the loop
if smart_data['model'] != 'Unknown' and smart_data['serial'] != 'Unknown': if smart_data['model'] != 'Unknown' and smart_data['serial'] != 'Unknown':