Restart when the MCU stops reporting

After about 2.5 days the chip stopped receiving MCU replies while writes still
went out, so switches looked stuck. Restart after 5 quiet minutes, but only if
the link worked earlier in that boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-09 01:17:11 +01:00
1 parent a355f64d1a
commit 06b259cb1b
3 files changed
+12 -2

No files matched your search

+10 -1
View File
@@ -22,7 +22,7 @@ external_components:
- source:
type: git
url: https://mangavalk.com/mangavalk/esphome-wake-up-light-ii.git
ref: v1.0.3
ref: v1.0.4
components: [uart]
refresh: 1d
@@ -187,6 +187,15 @@ interval:
- interval: 60s
then:
- script.execute: apply_display_schedule
# After about 2.5 days the chip once stopped receiving the MCU's replies,
# while sending still worked. A restart fixed it, so restart after 5 quiet
# minutes. Only if the link worked earlier this boot, to avoid a restart loop.
- lambda: |-
uint32_t last = id(last_mcu_report);
if (last != 0 && millis() - last > 300000) {
ESP_LOGW("mcu", "No report from the MCU for %u s, restarting", (unsigned) ((millis() - last) / 1000));
App.safe_reboot();
}
###############################################################################
# Tuya MCU