Files
Flipdot-display/src/esp32/net/home_assistant.h
T
mangavalkandClaude Opus 5.5 93b9bec69a Add a page schedule with rotation, Home Assistant trigger rules and a Stopwatch tab
- Schedule: daily blocks from a start time, each with up to 6 rotating pages
  or bitmaps (own duration), switching with the effect or instantly. A manual
  pick (Show tab, HA Mode) lasts until the next block; Back to schedule ends it.
- Rules: an HA state (=, is not, above, below) shows a page while true, adds it
  to the rotation while true, or shows it for N seconds when it becomes true.
  Each rule is polled at its own interval, with a 60 s back-off on errors.
- PageSelector (pure logic, tested) decides the shown page; schedule stored in
  NVS; HA sensor Shown page and button Back to schedule.
- Web UI: Schedule and Stopwatch tabs, bitmaps used by pages or rules in their
  own subsection, schedule in export/import. Version 2.6.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 21:36:56 +02:00

28 lines
1.5 KiB
C

#pragma once
#include "logic/display_controller.h"
#include "logic/settings.h"
// Home Assistant integration over MQTT (with discovery):
// FlipDot Display Power switch: off = draw the off image and switch the display off
// FlipDot Display Mode select: the page shown during the day (a dynamic page, e.g.
// the built-in "Clock", or a bitmap)
// FlipDot Display Off image select: left on the dots when the display switches off
// ("Blank" or a bitmap)
// FlipDot Display IP sensor: the IP address
// FlipDot Display Firmware sensor: version and health, e.g. "2.1.0, ok, 0 crashes, ..."
// FlipDot Display Recovery button: restart into the recovery app (for 10 minutes)
// FlipDot Display Stopwatch switch: the stopwatch of the dynamic pages runs
// 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)
//
// 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.
void homeAssistantBegin(DisplayController &controller, const HomeAssistantSettings &settings);
void homeAssistantLoop();
bool homeAssistantConnected();
// Publish the firmware status (only sent when it changes, and again after a reconnect)
void homeAssistantSetFirmwareStatus(const char *status);