Replace page announcement
Using "sendme" in replace to text sensor "currentpage".
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user