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