Add conversions for Home Assistant values: duration, time, own texts, auto unit

- Show as number (multiplier, decimals, auto unit W -> kW -> MW, without
  minus sign), duration (seconds/minutes/hours as 2h 21m, 2:21:00, 2:21 or
  smart), time (HA timestamps in local time, with weekday or date, or
  relative: over 34 min / 12 min geleden) or own texts per state.
- Page format 3; version 2 pages are converted. Version 2.7.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-15 21:50:19 +02:00
1 parent 93b9bec69a
commit 87e242bf89
11 files changed
+601 -30

No files matched your search

+10
View File
@@ -388,6 +388,16 @@ bool appLocalTime(LocalTime &time)
struct timeval tv;
gettimeofday(&tv, nullptr);
time.millisecond = tv.tv_usec / 1000;
// Local time - UTC (summer time included), for Home Assistant's UTC timestamps
struct tm utc = {};
time_t seconds = tv.tv_sec;
gmtime_r(&seconds, &utc);
int day_diff = now.tm_yday - utc.tm_yday;
if (day_diff > 1) // around new year
day_diff = -1;
else if (day_diff < -1)
day_diff = 1;
time.utc_offset = day_diff * 24 * 60 + (now.tm_hour - utc.tm_hour) * 60 + (now.tm_min - utc.tm_min);
return true;
}