Slow mode replaces the late-evening quarter hours

Slow mode (Home Assistant switch "FlipDot Display Slow mode", dropdown
"FlipDot Display Slow mode interval", web UI Settings) makes the display
change only every 1, 2, 5, 10, 15, 20, 30 or 60 minutes, on the clock, and
powers it off in between: less noise. Nothing else is drawn meanwhile, also
no page changes. It updates at once after boot, the night, the Power switch
and live mode, and when it is switched off. Rules can override it ("show at
once in slow mode"): while their page is shown the display works normally.

Settings layout 7 and schedule layout 4 (older records are converted; they
are stored again once the firmware is marked good, so a rollback still
finds the old ones). Pages in older formats are rewritten in the current
one, in time-boxed steps. /api/status reports old_data_left.

Version 2.15.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-17 21:16:41 +02:00
1 parent a904615c51
commit 968492ca35
39 files changed
+726 -126

No files matched your search

+54
View File
@@ -32,6 +32,8 @@ static HASwitch stopwatchSwitch("FlipDotDisplayStopwatch");
static HAButton stopwatchReset("FlipDotDisplayStopwatchReset");
static HASensor shownSensor("FlipDotDisplayShownPage");
static HAButton backButton("FlipDotDisplayBackToSchedule");
static HASwitch slowSwitch("FlipDotDisplaySlowMode");
static HAPageSelect slowSelect("FlipDotDisplaySlowModeInterval");
// Removed entities: their retained discovery config is cleared, so Home Assistant
// deletes them instead of showing them as unavailable
@@ -180,6 +182,29 @@ static NameChoice mode = {modeSelect, nullptr, nullptr, DEFAULT_PAGE, pageNames,
static NameChoice offImage = {offSelect, "Blank", OFF_PAGE_BLANK, "Blank", bitmapNames,
[]() { return appSettings().off_page; }, appSelectOffPage};
// The slow mode interval as dropdown options ("15 minutes")
static void slowOption(int minutes, char *out, size_t size)
{
snprintf(out, size, minutes == 1 ? "%d minute" : "%d minutes", minutes);
}
static int slow_shown_minutes = -1;
// Reports slow mode (also when it was changed in the web UI)
static void slowModeUpdate()
{
const SlowModeSettings &slow = appSettings().slow_mode;
if (slowSwitch.getCurrentState() != slow.enabled)
slowSwitch.setState(slow.enabled);
if (slow_shown_minutes != slow.minutes)
{
slow_shown_minutes = slow.minutes;
char option[16];
slowOption(slow.minutes, option, sizeof(option));
slowSelect.setState(option);
}
}
static void clearRemovedEntities()
{
for (const char *id : REMOVED_SWITCHES)
@@ -242,6 +267,34 @@ void homeAssistantBegin(DisplayController &controller, const HomeAssistantSettin
backButton.setIcon("mdi:calendar-clock");
backButton.onCommand([](HAButton *) { appBackToSchedule(); });
slowSwitch.setName("FlipDot Display Slow mode");
slowSwitch.setIcon("mdi:snail");
slowSwitch.setCurrentState(appSettings().slow_mode.enabled);
slowSwitch.onCommand([](bool state, HASwitch *sender) {
appSetSlowMode(state);
sender->setState(appSettings().slow_mode.enabled);
});
slowSelect.setName("FlipDot Display Slow mode interval");
slowSelect.setIcon("mdi:timer-sand");
{
std::vector<String> options;
char option[16];
for (uint8_t minutes : SLOW_MODE_MINUTES)
{
slowOption(minutes, option, sizeof(option));
options.push_back(option);
}
slowSelect.setOptions(options);
}
slowSelect.onCommand([](const char *option) {
const char *error = appSetSlowModeMinutes(atoi(option));
if (error)
Serial.printf("Home Assistant \"%s\": %s\n", option, error);
slow_shown_minutes = -1; // report the (new) state back
slowModeUpdate();
});
slowModeUpdate();
firmwareSensor.setName("FlipDot Display Firmware");
firmwareSensor.setIcon("mdi:chip");
@@ -286,6 +339,7 @@ void homeAssistantLoop()
firmware.loop();
mode.update();
offImage.update();
slowModeUpdate();
// Started or stopped in the web UI
if (stopwatchSwitch.getCurrentState() != stopwatch.running())
stopwatchSwitch.setState(stopwatch.running());
+2
View File
@@ -16,6 +16,8 @@
// FlipDot Display Stopwatch reset button: back to 0
// FlipDot Display Shown page sensor: the page or bitmap on the display now
// FlipDot Display Back to schedule button: ends a manual pick (the Mode dropdown)
// FlipDot Display Slow mode switch: the display only changes every few minutes
// FlipDot Display Slow mode interval select: how often ("15 minutes"; settings.slow_mode)
//
// The broker comes from the settings (web UI); an empty host means BROKER_ADDR, MQTT_USER
// and MQTT_PASSWORD from secrets.h. Changes need a restart.