Home buttons new format - Entities

Modernise the button "Entities" flow on page Home to improve performance.
This commit is contained in:
Edward Firmo
2023-08-23 20:04:37 +02:00
parent f399d757e5
commit 1ad3d7ef4b
14 changed files with 75 additions and 133 deletions

View File

@@ -497,9 +497,9 @@ api:
## Entities pages button
- lambda: |-
if (${verbose_log}) ESP_LOGD("service.global_settings", "Entities pages button - Start");
id(home_entities_pages) = (entities_pages);
id(home_entities_pages_icon) = entities_pages_icon.c_str();
id(home_entities_pages_icon_color) = entities_pages_icon_color;
id(disp1).send_command_printf("is_entities=%i", (entities_pages) ? 1 : 0);
id(disp1).set_component_text_printf("home.bt_entities", "%s", entities_pages_icon.c_str());
id(disp1).set_component_font_color("home.bt_entities", entities_pages_icon_color);
## Alarm button
- lambda: |-
@@ -710,20 +710,6 @@ globals:
restore_value: true
initial_value: '0'
##### Entities pages button #####
- id: home_entities_pages
type: bool
restore_value: false
initial_value: 'false'
- id: home_entities_pages_icon
type: std::string
restore_value: false
initial_value: ''
- id: home_entities_pages_icon_color
type: int
restore_value: false
initial_value: '52857'
##### START - BINARY SENSOR CONFIGURATION #####
binary_sensor:
@@ -1442,8 +1428,6 @@ script:
id(disp1).set_component_font_color("home.time", id(home_time_color));
id(disp1).set_component_font_color("home.icon_top_01", id(home_relay1_icon_color));
id(disp1).set_component_font_color("home.icon_top_02", id(home_relay2_icon_color));
id(disp1).set_component_font_color("home.button06_icon", id(home_entities_pages_icon_color));
- id: refresh_datetime
mode: restart
@@ -1545,36 +1529,15 @@ script:
- lambda: if (${verbose_log}) ESP_LOGD("script.update_page_home", "Starting");
- if:
condition:
- binary_sensor.is_on: nextion_init
#- binary_sensor.is_on: nextion_init
- text_sensor.state: # Is home page visible?
id: current_page
state: 'home'
then:
- script.execute:
id: refresh_datetime
- script.execute:
id: refresh_relays
- script.execute:
id: refresh_wifi_icon
- lambda: |-
// Show Entities pages button
if (${verbose_log}) ESP_LOGD("script.update_page_home", "Show Entities pages button");
if (id(home_entities_pages))
{
if (id(home_entities_pages_icon) == "" or id(home_entities_pages_icon).empty()) id(home_entities_pages_icon) = "\uEDCF";
id(disp1).set_component_text_printf("button06_icon", id(home_entities_pages_icon).c_str());
id(disp1).show_component("button06");
id(disp1).show_component("button06_icon");
}
else
{
id(disp1).hide_component("button06");
id(disp1).hide_component("button06_icon");
}
- script.execute:
id: addon_climate_update_page_home
- script.execute: refresh_datetime
- script.execute: refresh_relays
- script.execute: refresh_wifi_icon
- script.execute: addon_climate_update_page_home
- lambda: if (${verbose_log}) ESP_LOGD("script.update_page_home", "Finished");
- id: service_call_alarm_control_panel