From dd6dd172e2daeb2e6c72ef854f4dde342f6d264c Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:25:58 +0100 Subject: [PATCH] Use blueprint status to set api variable on TFT --- esphome/nspanel_esphome_core.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index 336e622..5afa494 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -115,11 +115,11 @@ wifi: password: ${ap_password} on_connect: - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected()) ? 1 : 0); + 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(); on_disconnect: - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected()) ? 1 : 0); + 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(); ##### OTA PASSWORD ##### @@ -183,11 +183,11 @@ api: reboot_timeout: 60min on_client_connected: - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected()) ? 1 : 0); + 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(); on_client_disconnected: - lambda: |- - disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected()) ? 1 : 0); + 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(); services: # Dynamically configures button properties on a specified page, enhancing UI interactivity by allowing updates to button appearance and behavior based on given parameters. @@ -1459,7 +1459,8 @@ sensor: then: - lambda: |- // Update api value on Nextion - disp1->send_command_printf("api=%i", (x > 99) ? 1 : 0); + disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected() and x > 99) ? 1 : 0); + refresh_wifi_icon->execute(); ##### INTERNAL TEMPERATURE SENSOR, ADC VALUE ##### - id: ntc_source