From 6d2de0d32bc4b751a7f52a3c1db3fcf1a080c098 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sun, 10 Aug 2025 23:12:15 +0200 Subject: [PATCH] Guard against invalid gang_count when restoring index --- ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml index 7eace18..2524545 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml @@ -283,7 +283,9 @@ script: index: !lambda if (id(is_us_model)) return 1; else return 0; - select.set_index: id: sl_tx_model_gang - index: !lambda return (id(gang_count)-1); + index: !lambda |- + if (id(gang_count) < 1 || id(gang_count) > 4) return 0; // default to 1-Gang + return static_cast(id(gang_count)) - 1; select: - id: sl_tx_model_format