fix(monitor): round the temperature in alerts and tidy the #408 follow-ups

This commit is contained in:
MacRimi
2026-09-29 17:10:27 +02:00
parent 57a69e1f92
commit a17f4120e3
3 changed files with 8 additions and 8 deletions
@@ -122,10 +122,9 @@ class CommandDescriptionsTests(unittest.TestCase):
"temperatureIncomplete", "temperatureUnavailableCount", "temperatureIncomplete", "temperatureUnavailableCount",
): ):
temporary["storage"].setdefault(key, catalog("en")["storage"][key]) temporary["storage"].setdefault(key, catalog("en")["storage"][key])
# The temperature alert fallback is new English-only runtime # Every shipped locale carries the temperature alert fallback
# text until locale migration. Seed only its four new keys # keys; the seed only guards a catalog that lacks them. The
# in this disposable steady-state catalog; shipped locales # runtime fallback is tested separately.
# remain unchanged and runtime fallback is tested separately.
source_fallback = catalog("en")["runtime"]["notifications"]["fallback"] source_fallback = catalog("en")["runtime"]["notifications"]["fallback"]
fallback = temporary["runtime"]["notifications"]["fallback"] fallback = temporary["runtime"]["notifications"]["fallback"]
for key in ("temperatureAlertTitle", "temperatureAlertBody", for key in ("temperatureAlertTitle", "temperatureAlertBody",
+1 -1
View File
@@ -6987,7 +6987,7 @@
} }
}, },
"temperature": { "temperature": {
"sampleSpan": "Las muestras elevadas abarcan {duration}." "sampleSpan": "Lecturas altas registradas a lo largo de {duration}."
} }
} }
} }
+4 -3
View File
@@ -1574,7 +1574,8 @@ class HealthMonitor:
duration_str = f'{actual_minutes}m {actual_seconds}s' if actual_minutes > 0 else f'{actual_seconds}s' duration_str = f'{actual_minutes}m {actual_seconds}s' if actual_minutes > 0 else f'{actual_seconds}s'
status = 'WARNING' status = 'WARNING'
reason = f'Sensor temperature {max_temp}°C >80°C; high samples span {duration_str}' shown_temp = round(max_temp, 1) # as the widget shows it
reason = f'Sensor temperature {shown_temp}°C >80°C; high samples span {duration_str}'
# Record the existing dismissable error contract # Record the existing dismissable error contract
health_persistence.record_error( health_persistence.record_error(
@@ -1583,8 +1584,8 @@ class HealthMonitor:
severity='WARNING', severity='WARNING',
reason=reason, reason=reason,
details={ details={
'temperature': max_temp, 'duration': actual_duration, 'temperature': shown_temp, 'duration': actual_duration,
'dismissable': True, 'value': max_temp, 'threshold': 80, 'dismissable': True, 'value': shown_temp, 'threshold': 80,
'details': f'High samples span {duration_str}.', 'details': f'High samples span {duration_str}.',
# Explicit provenance for render-time localization; # Explicit provenance for render-time localization;
# older/manual detail strings remain verbatim. # older/manual detail strings remain verbatim.