So, ich habe das jetzt mit folgenden Commits in dev umgesetzt:
committed 06:28PM - 27 Aug 26 UTC
Three small, independent fixes in the topicSleepTimer path:
- On reconnect, topi… cSleepTimer published System_GetSleepTimerTimeStamp()
-- the internal millis() start-timestamp, a meaningless huge number --
instead of the configured minutes. Publish the configured value (or 0).
- The idle-rejection and the "0" disable branches published to topicSleep
(the power on/off state topic) instead of topicSleepTimer, so cancelling
a timer or rejecting one while idle emitted a spurious power-state value.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
committed 06:28PM - 27 Aug 26 UTC
Publishes the live sleep-timer status as a single JSON object on the new
non-ret… ained state topic sleep_timer_state, e.g.
{"mode":"MINUTES","remainingMinutes":29,"remainingTracks":0}
mode is OFF/MINUTES/EOT/EOP/EO5T. This lets a home-automation system show
the remaining time (minute-timer, counted down once per minute) or the
remaining tracks (EOT/EO5T/EOP, updated on track change).
Design:
- One JSON topic rather than several scalar topics, keeping the flat topic
scheme uncluttered.
- Non-retained, matching every other ESPuino state topic (nothing stale
lives in the broker; the reconnect handler re-publishes current state,
and a clean OFF is emitted before shutdown).
- Single publisher: System_SleepHandler() calls the self-deduplicating
Mqtt_PublishSleepTimerState() every loop, so a timer set from any source
(MQTT, RFID modification card, button) is reflected within one iteration
without instrumenting each set-site.
- New System_GetSleepTimerRemainingMinutes() helper avoids duplicating the
countdown math.
- Web-UI MQTT topic preview and the README MQTT table list the new topic.
Reimplemented from the idea in #446 (TMHEINE).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Das Ganze funktioniert jetzt mit einem zusätzlichen Topic, welches eine JSON-Payload hat:
sleep_timer_state {"mode":"OFF","remainingMinutes":0,"remainingTracks":0}
Mode kann hierbei OFF/MINUTES/EOT/EOP/EO5T sein. Das Feld remainingMinutes ist nur gesetzt, wenn mode=MINUTES. remainingTracks entsprechend, wenn mode=EOT oder EOP oder EO5T. Die alten Topics habe ich, zwecks Abwärtskompatibilität, unverändert gelassen.
@Joe91 Bei der Gelegenheit ist mir noch ein Bug aufgefallen, den ich bisher noch nicht getriggert hatte:
committed 06:24PM - 27 Aug 26 UTC
Mqtt_Init() resolves the <MAC> token in the device id before the WiFi
driver is … up, and WiFi.macAddress() returns 00:00:00:00:00:00 until then,
so topics used ESPuino-000000000000. Read the STA MAC from eFuse via
esp_read_mac() in Wlan_GetMacAddress() instead -- always available and the
same value WiFi.macAddress() returns once connected (the web interface was
already correct because it reads the MAC later, at request time).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>