feat(sidebar): show max CPU temperature instead of static GOOD/OK/HIGH

This commit is contained in:
mawei
2026-06-04 20:16:14 +08:00
parent 30239bfbd2
commit e578a8ef87
+8 -3
View File
@@ -123,14 +123,19 @@ class Sidebar(Widget, SidebarSP):
self._net_strength = max(0, min(5, strength.raw + 1)) if strength.raw > 0 else 0
def _update_temperature_status(self, device_state):
# Get max CPU temperature across all cores
cpu_temps = device_state.cpuTempC
max_temp = max(cpu_temps) if cpu_temps else 0.0
temp_str = f"{max_temp:.0f}°C"
thermal_status = device_state.thermalStatus
if thermal_status == ThermalStatus.green:
self._temp_status.update(tr_noop("TEMP"), tr_noop("GOOD"), Colors.GOOD)
self._temp_status.update(tr_noop("TEMP"), temp_str, Colors.GOOD)
elif thermal_status == ThermalStatus.yellow:
self._temp_status.update(tr_noop("TEMP"), tr_noop("OK"), Colors.WARNING)
self._temp_status.update(tr_noop("TEMP"), temp_str, Colors.WARNING)
else:
self._temp_status.update(tr_noop("TEMP"), tr_noop("HIGH"), Colors.DANGER)
self._temp_status.update(tr_noop("TEMP"), temp_str, Colors.DANGER)
def _update_connection_status(self, device_state):
last_ping = device_state.lastAthenaPingTime