From 8f46a44ccabce4861981068243325fced1d34303 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:53:06 +0100 Subject: [PATCH] Store TFT file to resist power cycle --- .../esphome/nspanel_esphome_addon_upload_tft.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml b/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml index 46e433f..c87b035 100644 --- a/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml +++ b/advanced/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -213,6 +213,7 @@ script: - id: set_tft_file mode: restart then: + - delay: 2s - lambda: |- static const char *const TAG = "addon_upload_tft.script.set_tft_file"; std::string model = tft_file_model->state; @@ -1239,8 +1240,9 @@ select: disabled_by_default: false icon: mdi:file-sync set_action: - - lambda: if (tft_file_model->active_index().has_value()) id(tft_model) = tft_file_model->active_index().value(); - - script.execute: set_tft_file + - lambda: |- + if (tft_file_model->active_index().has_value()) id(tft_model) = tft_file_model->active_index().value(); + set_tft_file->execute(); - id: tft_file_branch name: ${device_name} Update TFT display - Branch @@ -1257,8 +1259,9 @@ select: disabled_by_default: true icon: mdi:file-sync set_action: - - lambda: if (tft_file_branch->active_index().has_value()) id(tft_branch) = tft_file_branch->active_index().value(); - - script.execute: set_tft_file + - lambda: |- + if (tft_file_branch->active_index().has_value()) id(tft_branch) = tft_file_branch->active_index().value(); + set_tft_file->execute(); sensor: - id: !extend display_mode