mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-30 11:26:23 +00:00
Update flask_server.py
This commit is contained in:
@@ -5721,52 +5721,45 @@ def get_hardware_info():
|
|||||||
fans = []
|
fans = []
|
||||||
|
|
||||||
for line in sensors_output.split('\n'):
|
for line in sensors_output.split('\n'):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Chip names don't have ":" and are not indented
|
# Chip names don't have ":" and are not indented
|
||||||
if not ':' in line and not line.startswith(' ') and not line.startswith('Adapter'):
|
if not ':' in line and not line.startswith(' ') and not line.startswith('Adapter'):
|
||||||
current_chip = line
|
current_chip = line
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Detect adapter line
|
# Detect adapter line
|
||||||
if line.startswith('Adapter:'):
|
if line.startswith('Adapter:'):
|
||||||
current_adapter = line.replace('Adapter:', '').strip()
|
current_adapter = line.replace('Adapter:', '').strip()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Parse fan sensors
|
# Parse fan sensors
|
||||||
if ':' in line and not line.startswith(' '):
|
if ':' in line and not line.startswith(' '):
|
||||||
parts = line.split(':', 1)
|
parts = line.split(':', 1)
|
||||||
sensor_name = parts[0].strip()
|
sensor_name = parts[0].strip()
|
||||||
value_part = parts[1].strip()
|
value_part = parts[1].strip()
|
||||||
|
|
||||||
# Look for fan sensors (RPM)
|
# Look for fan sensors (RPM)
|
||||||
if 'RPM' in value_part:
|
if 'RPM' in value_part:
|
||||||
rpm_match = re.search(r'([\d.]+)\s*RPM', value_part)
|
rpm_match = re.search(r'([\d.]+)\s*RPM', value_part)
|
||||||
if rpm_match:
|
if rpm_match:
|
||||||
fan_speed = int(float(rpm_match.group(1)))
|
fan_speed = int(float(rpm_match.group(1)))
|
||||||
|
|
||||||
identified_name = identify_fan(sensor_name, current_adapter, current_chip)
|
identified_name = identify_fan(sensor_name, current_adapter, current_chip)
|
||||||
|
|
||||||
fans.append({
|
fans.append({
|
||||||
'name': identified_name,
|
'name': identified_name,
|
||||||
'original_name': sensor_name,
|
'original_name': sensor_name,
|
||||||
'speed': fan_speed,
|
'speed': fan_speed,
|
||||||
'unit': 'RPM',
|
'unit': 'RPM',
|
||||||
'adapter': current_adapter
|
'adapter': current_adapter
|
||||||
})
|
})
|
||||||
# print(f"[v0] Fan sensor: {identified_name} ({sensor_name}) = {fan_speed} RPM")
|
|
||||||
pass
|
|
||||||
|
|
||||||
hardware_data['sensors']['fans'] = fans
|
hardware_data['sensors']['fans'] = fans
|
||||||
# print(f"[v0] Found {len(fans)} fan sensor(s)")
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
|
||||||
# print(f"[v0] Error getting fan info: {e}")
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# print(f"[v0] Error getting psutil sensors: {e}")
|
# print(f"[v0] Error getting fan sensors: {e}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Power Supply / UPS
|
# Power Supply / UPS
|
||||||
|
|||||||
Reference in New Issue
Block a user