Replace sendme by current_page text sensor

Solves #1900
This commit is contained in:
Edward Firmo
2024-03-14 22:38:22 +01:00
parent ce04dd7b99
commit 79363673d3
95 changed files with 549 additions and 127 deletions

View File

@@ -136,13 +136,12 @@ script:
- lambda: |-
ESP_LOGD("addon_upload_tft.script.open_upload_dialog", "Showing upload dialog page");
disp1->goto_page("confirm");
page_id->update();
- wait_until:
condition:
- lambda: return (page_id->state == 26);
- lambda: return (current_page->state == "confirm");
timeout: 2s
- lambda: |-
if (page_id->state == 26) {
if (current_page->state == "confirm") {
disp1->hide_component("bclose");
disp1->hide_component("bt_accept");
disp1->hide_component("bt_clear");
@@ -152,7 +151,6 @@ script:
#elif defined(USE_ESP_IDF)
disp1->set_component_text_printf("confirm.title", "Upload TFT\\rESP-IDF");
#endif
page_id->update();
- id: report_upload_progress
mode: restart
@@ -162,7 +160,7 @@ script:
- lambda: |-
ESP_LOGD("addon_upload_tft.script.report_upload_progress", "%s", message.c_str());
if (id(tft_is_valid)) {
if (page_id->state != 26) {
if (current_page->state != "confirm") {
open_upload_dialog->execute();
}
display_wrapped_text->execute("confirm.body", message.c_str(), 18);
@@ -207,10 +205,9 @@ script:
- delay: 2s
- script.execute: open_upload_dialog
- script.wait: open_upload_dialog
- lambda: page_id->update();
- wait_until:
condition:
- lambda: return (page_id->state == 26);
- lambda: return (current_page->state == "confirm");
timeout: 2s
- script.execute:
id: report_upload_progress

View File

@@ -859,12 +859,8 @@ display:
- script.execute: setup_sequence
on_page:
lambda: |-
if (!id(is_uploading_tft)) {
page_id->update();
if (current_page->state != page_names[x] or x == 9) {
current_page->publish_state(page_names[x]);
page_changed->execute(page_names[x]);
}
if (current_page->state != page_names[x] or x == 9) {
current_page->publish_state(page_names[x]);
}
on_touch:
@@ -1528,23 +1524,6 @@ sensor:
internal: false
disabled_by_default: false
###### Page Id - Current #####
- id: page_id
name: Page Id
platform: nextion
variable_name: dp
precision: 0
accuracy_decimals: 0
internal: true
entity_category: diagnostic
on_value:
then:
- lambda: |-
if (!id(is_uploading_tft) and current_page->state != page_names[x]) {
current_page->publish_state(page_names[x]);
page_changed->execute(page_names[x]);
}
##### Display mode (1 = EU, 2 = US, 3 = US Landscape)
- id: display_mode
name: Display mode
@@ -1666,10 +1645,17 @@ text_sensor:
##### Current page name #####
- id: current_page
name: Current Page
platform: template
platform: nextion
component_name: current_page
icon: mdi:tablet-dashboard
internal: false
disabled_by_default: false
on_value:
then:
- lambda: |-
if (!id(is_uploading_tft)) {
page_changed->execute(x.c_str());
}
- id: notification_label
name: Notification Label
@@ -2646,12 +2632,6 @@ script:
- id: setup_sequence
mode: restart
then:
- lambda: |-
page_id->update();
- wait_until:
condition:
- lambda: !lambda return (not isnan(page_id->state));
timeout: 15s
- lambda: display_charset->update();
- wait_until:
condition: