User exit reparse from upload in the component

This commit is contained in:
Edward Firmo
2024-02-09 09:55:36 +01:00
parent c60f4e97ce
commit 7e70e7c3c1

View File

@@ -15,18 +15,15 @@ substitutions:
##############################################
##### DON'T CHANGE THIS #####
upload_tft_baud_rate: "921600"
upload_tft_baud_rate: "921600" # To do: Move to UI
#############################
##### External components #####
external_components:
- source:
type: git
url: https://github.com/edwardtfn/esphome
ref: nextion-23
- source: github://pr#6192 # Change this when that PR gets released (2024.2?)
components:
- nextion
refresh: 300s
refresh: 3s # Change this before the release: 300s
api:
on_client_connected:
@@ -121,7 +118,7 @@ script:
- lambda: |-
static const char *const TAG = "addon_upload_tft.script.nextion_upload";
ESP_LOGD(TAG, "Starting TFT upload...");
id(tft_upload_result) = disp1->upload_tft();
id(tft_upload_result) = disp1->upload_tft(!disp1->is_setup());
ESP_LOGD(TAG, "TFT upload: %s", esphome::nextion::Nextion::tft_upload_result_to_string(id(tft_upload_result)));
- id: open_upload_dialog
@@ -419,14 +416,16 @@ script:
- script.wait: report_upload_progress
- if:
condition:
not:
- lambda: return id(tft_upload_result) == esphome::nextion::Nextion::TFTUploadResult::UNKNOWN;
- lambda: return id(tft_upload_result) == esphome::nextion::Nextion::TFTUploadResult::UPLOAD_IN_PROGRESS;
- lambda: return id(tft_upload_result) == esphome::nextion::Nextion::TFTUploadResult::NEXTION_ERROR_PREPARATION_FAILED;
- lambda: return id(tft_upload_result) == esphome::nextion::Nextion::TFTUploadResult::NEXTION_ERROR_INVALID_RESPONSE;
- lambda: |-
return
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::UNKNOWN and
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::UPLOAD_IN_PROGRESS and
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::NEXTION_ERROR_PREPARATION_FAILED and
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::NEXTION_ERROR_INVALID_RESPONSE;
then:
- delay: 5s
- lambda: |-
ESP_LOGI("addon_upload_tft.script.upload_tft_attempt", "Restarting ESPHome");
App.safe_reboot();
- id: !extend watchdog