Replace page announcement

Using "sendme" in replace to text sensor "currentpage".
This commit is contained in:
Edward Firmo
2023-11-27 20:34:40 +01:00
parent a60ad3abd3
commit 629bf0aad1
88 changed files with 104 additions and 506 deletions

View File

@@ -741,11 +741,14 @@ display:
platform: nextion
uart_id: tf_uart
start_up_page: 8
on_page: # This requires `sendme` to be executed on Nextion side
on_page:
lambda: |-
static const char *const TAG = "display.disp1.on_page";
ESP_LOGD(TAG, "Nextion page changed");
ESP_LOGD(TAG, "New page: %s (%i)" , id(page_names)[x].c_str(), x);
current_page->publish_state(id(page_names)[x].c_str());
page_changed->execute(id(page_names)[x].c_str());
on_setup:
- script.execute: boot_sequence
@@ -1392,25 +1395,25 @@ text_sensor:
##### Current page name #####
- name: ${device_name} Current page
id: current_page
#platform: template
platform: nextion
nextion_id: disp1
component_name: currentpage
platform: template
#platform: nextion
#nextion_id: disp1
#component_name: currentpage
icon: mdi:tablet-dashboard
internal: false
disabled_by_default: false
filters:
- lambda: |-
x = x.c_str();
x.shrink_to_fit();
return x;
on_value:
then:
- lambda: |-
static const char *const TAG = "text_sensor.current_page";
// Construct new page
ESP_LOGV(TAG, "Construct new page");
page_changed->execute(x.c_str());
#filters:
# - lambda: |-
# x = x.c_str();
# x.shrink_to_fit();
# return x;
#on_value:
# then:
# - lambda: |-
# static const char *const TAG = "text_sensor.current_page";
# // Construct new page
# ESP_LOGV(TAG, "Construct new page");
# page_changed->execute(x.c_str());
- name: ${device_name} Notification Label
platform: template