Remove redundant refresh calls

Solves #1529
This commit is contained in:
Edward Firmo
2024-01-04 23:02:48 +01:00
parent f77c7efbd6
commit 37f2606aed
3 changed files with 11 additions and 22 deletions

View File

@@ -160,7 +160,7 @@ script:
- lambda: |-
// Update chips
if (id(is_embedded_thermostat))
id(update_climate_icon).execute("home.icon_top_03", int(thermostat_embedded->action), int(thermostat_embedded->mode));
update_climate_icon->execute("home.icon_top_03", int(thermostat_embedded->action), int(thermostat_embedded->mode));
- id: !extend set_climate
then:

View File

@@ -113,8 +113,7 @@ time:
on_time_sync:
then:
- logger.log: "System clock synchronized"
- script.execute:
id: refresh_datetime
- script.execute: refresh_datetime
##### START - API CONFIGURATION #####
api:
@@ -1442,12 +1441,10 @@ switch:
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
then:
- script.execute:
id: refresh_relays
- script.execute: refresh_relays
on_turn_off:
then:
- script.execute:
id: refresh_relays
- script.execute: refresh_relays
##### PHYSICAL SWITCH 2 ######
- name: ${device_name} Relay 2
platform: gpio
@@ -1457,12 +1454,10 @@ switch:
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
then:
- script.execute:
id: refresh_relays
- script.execute: refresh_relays
on_turn_off:
then:
- script.execute:
id: refresh_relays
- script.execute: refresh_relays
##### DISPLAY ALWAYS ON #####
- name: ${device_name} Nextion display - Power
@@ -2209,8 +2204,6 @@ script:
- id: page_home
mode: restart
then:
- script.execute: refresh_relays
- script.execute: refresh_datetime
- script.execute: refresh_wifi_icon
- id: page_keyb_num
@@ -2324,7 +2317,7 @@ script:
std::string time_format_str_sleep = time_format_str;
if (time_format_str_sleep.find("%p") != std::string::npos)
time_format_str_sleep.replace(time_format_str_sleep.find("%p"), sizeof("%p")-1, meridiem_text.c_str());
disp1->set_component_text_printf("screensaver.text", "%s", id(time_provider).now().strftime(time_format_str_sleep).c_str());
disp1->set_component_text_printf("text", "%s", id(time_provider).now().strftime(time_format_str_sleep).c_str());
}
ESP_LOGV(TAG, "Updating home page meridiem");
disp1->set_component_text_printf("home.meridiem", "%s", (time_format_str.find("%p") != std::string::npos) ? meridiem_text.c_str() : " ");
@@ -2354,11 +2347,9 @@ script:
then:
- lambda: |-
// Chips - Relays
if (relay_1->state) disp1->set_component_text_printf("home.icon_top_01", "%s", id(home_relay1_icon).c_str());
else disp1->set_component_text_printf("icon_top_01", "\uFFFF");
if (relay_2->state) disp1->set_component_text_printf("home.icon_top_02", "%s", id(home_relay2_icon).c_str());
else disp1->set_component_text_printf("home.icon_top_02", "\uFFFF");
// Hardware buttons - Fallback mode
disp1->set_component_text_printf("home.icon_top_01", "%s", (relay_1->state) ? id(home_relay1_icon).c_str() : "\uFFFF");
disp1->set_component_text_printf("home.icon_top_02", "%s", (relay_2->state) ? id(home_relay2_icon).c_str() : "\uFFFF");
// Hardware buttons bars - Fallback mode
if (relay1_local->state) disp1->send_command_printf("home.left_bt_pic.val=%i", (relay_1->state) ? 1 : 0);
if (relay2_local->state) disp1->send_command_printf("home.right_bt_pic.val=%i", (relay_2->state) ? 1 : 0);
@@ -3148,8 +3139,6 @@ script:
});
}
refresh_wifi_icon->execute();
// Report ESPHome
ESP_LOGI(TAG, "ESPHome:");
ESP_LOGI(TAG, " Version: ${version}");
@@ -3186,6 +3175,6 @@ script:
ESP_LOGW(TAG, " TFT: UNKNOWN");
else
ESP_LOGI(TAG, " TFT: %s", version_tft->state.c_str());
}
refresh_wifi_icon->execute();
ESP_LOGV(TAG, "Finished");

Binary file not shown.