Update wifi icon when connection changes

This commit is contained in:
Edward Firmo
2024-03-13 20:17:49 +01:00
parent f49aadd51e
commit 4f21cb442a

View File

@@ -113,6 +113,14 @@ wifi:
ap:
ssid: "${name}"
password: ${ap_password}
on_connect:
- lambda: |-
disp1->send_command_printf("api=%i", (wifi_component->is_connected() and api_server->is_connected()) ? 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);
refresh_wifi_icon->execute();
##### OTA PASSWORD #####
ota:
@@ -173,6 +181,14 @@ time:
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()) ? 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);
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.
- service: button # yamllint disable-line rule:indentation
@@ -2666,7 +2682,7 @@ script:
then: # Wi-Fi connected
- lambda: |-
if (current_page->state == "boot") {
disp1->set_component_text("boot.ip_addr", network::get_ip_address().str().c_str());
disp1->set_component_text("boot.ip_addr", network::get_ip_address().str().c_str()); // To do: get_ip_addresses()[0]
set_brightness->execute(100);
}
- wait_until: