Use back_page_id on screensaver page
Let's simplify things!
This commit is contained in:
@@ -430,15 +430,6 @@ api:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
static const char *const TAG = "service.open_entity_settings_page";
|
static const char *const TAG = "service.open_entity_settings_page";
|
||||||
|
|
||||||
auto pageIndex = [](const std::string& page_name) -> uint8_t {
|
|
||||||
for (uint8_t i = 0; i < id(page_names).size(); ++i) {
|
|
||||||
if (id(page_names)[i] == page_name) {
|
|
||||||
return i; // Return the index if found
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0u; // Return 0 (home page) if not found
|
|
||||||
};
|
|
||||||
|
|
||||||
detailed_entity->publish_state(entity);
|
detailed_entity->publish_state(entity);
|
||||||
if (page == "alarm_control_panel") page = "alarm";
|
if (page == "alarm_control_panel") page = "alarm";
|
||||||
std::string cmd_page = std::string("page ") + page.c_str();
|
std::string cmd_page = std::string("page ") + page.c_str();
|
||||||
@@ -447,7 +438,7 @@ api:
|
|||||||
page_label = page_label.replace(page_label.find("\\r"), 2, " ");
|
page_label = page_label.replace(page_label.find("\\r"), 2, " ");
|
||||||
}
|
}
|
||||||
disp1->set_component_text_printf("page_label", "%s", page_label.c_str());
|
disp1->set_component_text_printf("page_label", "%s", page_label.c_str());
|
||||||
disp1->send_command_printf("back_page_id=%i", pageIndex(back_page.c_str()));
|
set_page_id->execute("back_page_id", back_page.c_str());
|
||||||
if (page == "climate")
|
if (page == "climate")
|
||||||
{
|
{
|
||||||
if (entity == "embedded_climate") addon_climate_set_climate_friendly_name->execute(page_label.c_str());
|
if (entity == "embedded_climate") addon_climate_set_climate_friendly_name->execute(page_label.c_str());
|
||||||
@@ -2448,21 +2439,7 @@ script:
|
|||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
static const char *const TAG = "script.page_screensaver";
|
set_page_id->execute("back_page_id", wakeup_page_name->state.c_str());
|
||||||
|
|
||||||
auto pageIndex = [](const std::string& page_name) -> uint8_t {
|
|
||||||
for (uint8_t i = 0; i < id(page_names).size(); ++i) {
|
|
||||||
if (id(page_names)[i] == page_name) {
|
|
||||||
return i; // Return the index if found
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0u; // Return 0 (home page) if not found
|
|
||||||
};
|
|
||||||
|
|
||||||
if (current_page->state == "screensaver") { // Is screensaver page visible?
|
|
||||||
ESP_LOGV(TAG, "Update screensaver page");
|
|
||||||
disp1->set_component_value("orign", pageIndex(wakeup_page_name->state));
|
|
||||||
}
|
|
||||||
|
|
||||||
- id: page_settings
|
- id: page_settings
|
||||||
mode: restart
|
mode: restart
|
||||||
@@ -2510,6 +2487,23 @@ script:
|
|||||||
id: page_weather
|
id: page_weather
|
||||||
page_number: 5
|
page_number: 5
|
||||||
|
|
||||||
|
- id: set_page_id
|
||||||
|
mode: queued
|
||||||
|
parameters:
|
||||||
|
variable: string
|
||||||
|
page: string
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
auto pageIndex = [](const std::string& page_name) -> uint8_t {
|
||||||
|
for (uint8_t i = 0; i < id(page_names).size(); ++i) {
|
||||||
|
if (id(page_names)[i] == page_name) {
|
||||||
|
return i; // Return the index if found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0u; // Return 0 (home page) if not found
|
||||||
|
};
|
||||||
|
disp1->send_command_printf("%s=%i", variable.c_str(), pageIndex(page.c_str()));
|
||||||
|
|
||||||
- id: exit_reparse
|
- id: exit_reparse
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
|
|||||||
Binary file not shown.
@@ -16,17 +16,11 @@ Page screensaver
|
|||||||
dim=0
|
dim=0
|
||||||
|
|
||||||
Touch Release Event
|
Touch Release Event
|
||||||
page orign.val
|
page back_page_id
|
||||||
|
|
||||||
Variable (int32) orign
|
|
||||||
Attributes
|
|
||||||
ID : 2
|
|
||||||
Scope: local
|
|
||||||
Value: 0
|
|
||||||
|
|
||||||
Timer swipestore
|
Timer swipestore
|
||||||
Attributes
|
Attributes
|
||||||
ID : 4
|
ID : 3
|
||||||
Scope : local
|
Scope : local
|
||||||
Period (ms): 50
|
Period (ms): 50
|
||||||
Enabled : no
|
Enabled : no
|
||||||
@@ -44,11 +38,11 @@ TouchCap wakeup
|
|||||||
|
|
||||||
Events
|
Events
|
||||||
Touch Press Event
|
Touch Press Event
|
||||||
page orign.val
|
page back_page_id
|
||||||
|
|
||||||
TouchCap swipe
|
TouchCap swipe
|
||||||
Attributes
|
Attributes
|
||||||
ID : 3
|
ID : 2
|
||||||
Scope: local
|
Scope: local
|
||||||
Value: 0
|
Value: 0
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -16,17 +16,11 @@ Page screensaver
|
|||||||
dim=0
|
dim=0
|
||||||
|
|
||||||
Touch Release Event
|
Touch Release Event
|
||||||
page orign.val
|
page back_page_id
|
||||||
|
|
||||||
Variable (int32) orign
|
|
||||||
Attributes
|
|
||||||
ID : 2
|
|
||||||
Scope: local
|
|
||||||
Value: 0
|
|
||||||
|
|
||||||
Timer swipestore
|
Timer swipestore
|
||||||
Attributes
|
Attributes
|
||||||
ID : 4
|
ID : 3
|
||||||
Scope : local
|
Scope : local
|
||||||
Period (ms): 50
|
Period (ms): 50
|
||||||
Enabled : no
|
Enabled : no
|
||||||
@@ -44,11 +38,11 @@ TouchCap wakeup
|
|||||||
|
|
||||||
Events
|
Events
|
||||||
Touch Press Event
|
Touch Press Event
|
||||||
page orign.val
|
page back_page_id
|
||||||
|
|
||||||
TouchCap swipe
|
TouchCap swipe
|
||||||
Attributes
|
Attributes
|
||||||
ID : 3
|
ID : 2
|
||||||
Scope: local
|
Scope: local
|
||||||
Value: 0
|
Value: 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user