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

+1
View File
@@ -70,6 +70,7 @@ From Tuya's definition for a sibling product (tuya-local issue #3821). See the R
- Keep `default_transition_length` at 0. A transition sends about 50 MCU writes a second.
- LibreTiny before v1.14.0 can hang after a software restart or OTA until powered off for about 30 seconds (LibreTiny issue #396). The config pins v1.14.0. Drop the pin once ESPHome defaults to it or newer.
- "Last Restart Reason" reports Power-On even after software restarts.
- On 2026-11-08, after about 2.5 days of uptime, the chip stopped receiving anything from the MCU while its own writes still went out. The owner saw Ambient Light turn on but not off, and MCU Link was OFF. A software restart fixed it. Since v1.0.4 the firmware restarts itself after 5 minutes without an MCU report, but only if the link worked earlier in that boot. The cause isn't known; suspects are the patched UART0 on PA13/PA14 or a LibreTiny serial issue.
## Status
+1 -1
View File
@@ -7,6 +7,6 @@ substitutions:
packages:
lamp:
url: https://mangavalk.com/mangavalk/esphome-wake-up-light-ii.git
ref: v1.0.3
ref: v1.0.4
files: [wake-up-light-ii.yaml]
refresh: 1d
+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