Every percentage and unit on the screens spaced like Home Assistant, also the tile values and YAML lambdas

The standard tile still joined a unit with a space, and the climate status, cover and light values and the slider
overlay wrote their own "%": all go through screen_text::with_unit / percent now (54% in Spanish, 54 % in German).
Found on the Guition in the end-to-end test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-19 17:24:33 +02:00
parent f02f429188
commit f7c452e7a7
4 changed files with 6 additions and 12 deletions
+1 -1
View File
@@ -3164,7 +3164,7 @@ inline void render_slot(size_t slot) {
else if (d == "media_player") value = tile_controls::media_state_text(t.state);
// A measurement in the screen's number format ("21,5 °C" in Dutch), as Home Assistant writes a state with a unit; a
// number without one (a code, a year) stays as it is, as there.
else if (!t.unit.empty() && !watch) value = screen_text::localize(value) + " " + t.unit;
else if (!t.unit.empty() && !watch) value = screen_text::with_unit(screen_text::localize(value), t.unit);
else if (!t.unit.empty() || d == "number" || d == "input_number" || d == "counter") value = screen_text::localize(value);
bool pending=t.loading(esphome::millis());
if(d=="weather" && std::isfinite(t.current)) {value=screen_text::decimal(t.current,1);if(!watch)value=screen_text::with_unit(value,t.unit);}