From 904937f06f554a9e25d2761748c4ebc3405904af Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 15 Mar 2024 01:36:20 +0100 Subject: [PATCH] Clean-up --- esphome/nspanel_esphome_core.yaml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index 11ee78d..fa2699d 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -110,13 +110,9 @@ wifi: ssid: ${wifi_ssid} password: ${wifi_password} on_connect: - - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99) ? 1 : 0); - refresh_wifi_icon->execute(); + - script.execute: refresh_wifi_icon on_disconnect: - - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99) ? 1 : 0); - refresh_wifi_icon->execute(); + - script.execute: refresh_wifi_icon ##### OTA PASSWORD ##### ota: @@ -178,13 +174,9 @@ api: id: api_server reboot_timeout: 60min on_client_connected: - - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99) ? 1 : 0); - refresh_wifi_icon->execute(); + - script.execute: refresh_wifi_icon on_client_disconnected: - - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99) ? 1 : 0); - refresh_wifi_icon->execute(); + - script.execute: refresh_wifi_icon services: # Dynamically configures button properties on a specified page, enhancing UI interactivity by allowing updates to button appearance and behavior based on given parameters. - service: button # yamllint disable-line rule:indentation @@ -282,7 +274,7 @@ api: if (entity_id.domain != "invalid" or entity == "embedded_climate") { detailed_entity->publish_state(entity); if (entity_id.domain == "alarm_control_panel") entity_id.domain = "alarm"; - disp1->send_command_printf("page %s", entity_id.domain.c_str()); + disp1->goto_page(entity_id.domain.c_str()); disp1->send_command_printf("back_page_id=%" PRIu8, get_page_id(back_page.c_str())); if (entity_id.domain == "climate") disp1->set_component_value("embedded", (entity == "embedded_climate") ? 1 : 0); @@ -1446,10 +1438,7 @@ sensor: return 0; on_value: then: - - lambda: |- - // Update api value on Nextion - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and x > 99) ? 1 : 0); - refresh_wifi_icon->execute(); + - script.execute: refresh_wifi_icon ##### INTERNAL TEMPERATURE SENSOR, ADC VALUE ##### - id: ntc_source @@ -2442,6 +2431,7 @@ script: then: - lambda: |- if (nextion_init->state) { + disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and blueprint_status->state > 99) ? 1 : 0); // Update Wi-Fi icon color disp1->set_component_font_color("home.wifi_icon", (blueprint_status->state > 99) ? (wifi_rssi->state > -70 ? 33808 : 64992) : 63488); // Update Wi-Fi icon