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