fix(notifications): align active health and temperature payloads

Local source candidate; non-English temperature migration and rendered layout validation remain pending.
This commit is contained in:
martino
2026-09-29 10:45:17 +02:00
parent d14b968930
commit 4c08ef6ea0
8 changed files with 386 additions and 13 deletions
+10 -6
View File
@@ -1503,10 +1503,10 @@ class HealthMonitor:
def _check_cpu_temperature(self) -> Optional[Dict[str, Any]]:
"""
Check CPU temperature with temporal logic:
Check the maximum reported sensor temperature with temporal logic:
- WARNING if temp >80°C sustained for >3 minutes
- Auto-clears if temp ≤80°C for 30 seconds
- No dismiss button (non-dismissable)
- Recorded errors retain their current dismissable flag
"""
cache_key = 'cpu_temp'
current_time = time.time()
@@ -1574,15 +1574,19 @@ class HealthMonitor:
duration_str = f'{actual_minutes}m {actual_seconds}s' if actual_minutes > 0 else f'{actual_seconds}s'
status = 'WARNING'
reason = f'CPU temperature {max_temp}°C >80°C sustained for {duration_str}'
reason = f'Sensor temperature {max_temp}°C >80°C; high samples span {duration_str}'
# Record non-dismissable error
# Record the existing dismissable error contract
health_persistence.record_error(
error_key='cpu_temperature',
category='temperature',
severity='WARNING',
reason=reason,
details={'temperature': max_temp, 'duration': actual_duration, 'dismissable': True}
details={
'temperature': max_temp, 'duration': actual_duration,
'dismissable': True, 'value': max_temp, 'threshold': 80,
'details': f'High samples span {duration_str}.',
}
)
elif len(recovery_samples) >= 3:
# Temperature has been ≤80°C for 30 seconds - clear the error
@@ -1595,7 +1599,7 @@ class HealthMonitor:
if health_persistence.is_error_active('cpu_temperature', category='temperature'):
# Keep the warning active
status = 'WARNING'
reason = f'CPU temperature {max_temp}°C still elevated'
reason = f'Sensor temperature {max_temp}°C still elevated'
else:
# No active warning yet
status = 'OK'