Improving watchdog
This commit is contained in:
@@ -41,21 +41,21 @@ api:
|
||||
clean_url = clean_url.substr(0, endPos + 1);
|
||||
}
|
||||
|
||||
if ( clean_url.empty() or clean_url == "default") url = tft_list->state;
|
||||
if ( clean_url.empty() or clean_url == "default") url = tft_update_url->state;
|
||||
upload_tft->execute(url.c_str());
|
||||
|
||||
button:
|
||||
##### UPDATE TFT DISPLAY #####
|
||||
- name: ${device_name} Update TFT display
|
||||
- id: tft_update
|
||||
name: ${device_name} Update TFT display
|
||||
platform: template
|
||||
icon: mdi:file-sync
|
||||
id: tft_update
|
||||
entity_category: config
|
||||
on_press:
|
||||
- lambda: |-
|
||||
static const char *const TAG = "button.tft_update.on_press";
|
||||
ESP_LOGD(TAG, "Update TFT display button pressed");
|
||||
upload_tft->execute(tft_list->state.c_str());
|
||||
upload_tft->execute(tft_update_url->state.c_str());
|
||||
|
||||
display:
|
||||
- id: !extend disp1
|
||||
@@ -1027,21 +1027,18 @@ script:
|
||||
id(is_uploading_tft) = false;
|
||||
ESP_LOGD(TAG, "Finished!");
|
||||
|
||||
select:
|
||||
- id: tft_list
|
||||
name: Update TFT display URL
|
||||
text:
|
||||
- id: tft_update_url
|
||||
name: ${device_name} Update TFT URL
|
||||
platform: template
|
||||
options:
|
||||
- "${nextion_update_url}"
|
||||
- "${nextion_blank_url}"
|
||||
initial_option: "${nextion_update_url}"
|
||||
optimistic: true
|
||||
restore_value: false
|
||||
internal: false
|
||||
icon: mdi:file-sync
|
||||
entity_category: config
|
||||
icon: mdi:file-arrow-up-down-outline
|
||||
disabled_by_default: true
|
||||
restore_value: true
|
||||
initial_value: ${nextion_update_url}
|
||||
mode: text
|
||||
set_action:
|
||||
- lambda: |-
|
||||
static const char *const TAG = "select.tft_list.set_action";
|
||||
ESP_LOGD(TAG, "Selected TFT URL: %s", x.c_str());
|
||||
then:
|
||||
- lambda: |-
|
||||
static const char *const TAG = "text.tft_update_url.set_action";
|
||||
ESP_LOGD(TAG, "Update TFT URL changed: %s", x.c_str());
|
||||
|
||||
@@ -1785,6 +1785,8 @@ script:
|
||||
id(screensaver_display_time) = screensaver_time;
|
||||
id(screensaver_display_time_color) = screensaver_time_color;
|
||||
|
||||
id(is_blueprint_updated) = true;
|
||||
|
||||
// Update home page
|
||||
ESP_LOGV(TAG, "Update home page");
|
||||
page_home->execute();
|
||||
@@ -1827,7 +1829,6 @@ script:
|
||||
timer_reset_all->execute(wakeup_page_name->state.c_str());
|
||||
|
||||
- lambda: |-
|
||||
id(is_blueprint_updated) = true;
|
||||
ESP_LOGV("script.global_settings", "Finished");
|
||||
|
||||
- id: ha_button
|
||||
@@ -2153,6 +2154,7 @@ script:
|
||||
then:
|
||||
- script.execute: refresh_relays
|
||||
- script.execute: refresh_datetime
|
||||
- script.execute: refresh_wifi_icon
|
||||
|
||||
- id: page_keyb_num
|
||||
mode: restart
|
||||
@@ -2296,7 +2298,7 @@ script:
|
||||
- lambda: |-
|
||||
if (nextion_init->state) {
|
||||
// Update Wi-Fi icon color
|
||||
disp1->set_component_font_color("home.wifi_icon", (id(is_blueprint_updated)) ? 33808 : 63488);
|
||||
disp1->set_component_font_color("home.wifi_icon", (id(is_blueprint_updated)) ? (wifi_rssi->state > -70 ? 33808 : 64992) : 63488);
|
||||
// Update Wi-Fi icon
|
||||
disp1->set_component_text_printf("home.wifi_icon", "%s",
|
||||
wifi_component->is_connected() ?
|
||||
@@ -2914,8 +2916,18 @@ script:
|
||||
} else {
|
||||
// report Wi-Fi status
|
||||
bool wifi_connected = wifi_component->is_connected();
|
||||
if (wifi_connected)
|
||||
ESP_LOGD(TAG, "Wi-Fi: %.0f dBm", wifi_rssi->state);
|
||||
if (wifi_connected) {
|
||||
float rssi = wifi_rssi->state;
|
||||
std::string rssi_status = "Unknown";
|
||||
if (rssi > -50) rssi_status = "Excellent";
|
||||
else if (rssi > -60) rssi_status = "Good";
|
||||
else if (rssi > -70) rssi_status = "Fair";
|
||||
else if (rssi > -80) rssi_status = "Weak";
|
||||
else rssi_status = "Poor";
|
||||
if (rssi > -70) ESP_LOGD(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status.c_str(), rssi);
|
||||
else if (rssi > -80) ESP_LOGW(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status.c_str(), rssi);
|
||||
else ESP_LOGE(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status.c_str(), rssi);
|
||||
}
|
||||
else
|
||||
ESP_LOGW(TAG, "Wi-Fi: DISCONNECTED");
|
||||
|
||||
@@ -2967,7 +2979,7 @@ script:
|
||||
disp1->send_command_printf("api=%i", id(is_blueprint_updated) ? 1 : 0);
|
||||
|
||||
if (!wifi_connected) {
|
||||
ESP_LOGD(TAG, "Retry Wi-Fi connection");
|
||||
ESP_LOGD(TAG, "Retrying Wi-Fi connection");
|
||||
wifi_component->retry_connect();
|
||||
}
|
||||
if (api_connected) {
|
||||
|
||||
Reference in New Issue
Block a user