Replace watchdog by dump_config
This commit is contained in:
@@ -113,6 +113,53 @@ script:
|
|||||||
call.perform();
|
call.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- id: !extend dump_config
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
// Check if more than one or none of the climate options are defined
|
||||||
|
#if defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT)
|
||||||
|
#error "Invalid settings for add-on Climate. More than one option selected: Cool + Heat."
|
||||||
|
#elif defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL)
|
||||||
|
#error "Invalid settings for add-on Climate. More than one option selected: Cool + Dual."
|
||||||
|
#elif defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL)
|
||||||
|
#error "Invalid settings for add-on Climate. More than one option selected: Heat + Dual."
|
||||||
|
#elif !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) && !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL)
|
||||||
|
#error "Invalid settings for add-on Climate. No option selected between Cool, Heat or Dual."
|
||||||
|
#endif
|
||||||
|
if (!id(is_uploading_tft)) {
|
||||||
|
static const char *const TAG = "nspanel_ha_blueprint";
|
||||||
|
uint cooler_relay = ${cooler_relay};
|
||||||
|
uint heater_relay = ${heater_relay};
|
||||||
|
ESP_LOGCONFIG(TAG, "Add-on climate:");
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL
|
||||||
|
ESP_LOGCONFIG(TAG, " Cool: Enabled");
|
||||||
|
if (cooler_relay == 1 or cooler_relay == 2)
|
||||||
|
ESP_LOGCONFIG(TAG, " Relay: %u", cooler_relay);
|
||||||
|
else
|
||||||
|
ESP_LOGE(TAG, " Relay: %u", cooler_relay);
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT
|
||||||
|
ESP_LOGCONFIG(TAG, " Heat: Enabled");
|
||||||
|
if (heater_relay == 1 or heater_relay == 2)
|
||||||
|
ESP_LOGCONFIG(TAG, " Relay: %u", heater_relay);
|
||||||
|
else
|
||||||
|
ESP_LOGE(TAG, " Relay: %u", heater_relay);
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL
|
||||||
|
ESP_LOGCONFIG(TAG, " Dual: Enabled");
|
||||||
|
if (cooler_relay == 1 or cooler_relay == 2)
|
||||||
|
ESP_LOGCONFIG(TAG, " Relay (cooler): %u", cooler_relay);
|
||||||
|
else
|
||||||
|
ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay);
|
||||||
|
if (heater_relay == 1 or heater_relay == 2)
|
||||||
|
ESP_LOGCONFIG(TAG, " Relay (heater): %u", heater_relay);
|
||||||
|
else
|
||||||
|
ESP_LOGE(TAG, " Relay (heater): %u", heater_relay);
|
||||||
|
if (cooler_relay == heater_relay)
|
||||||
|
ESP_LOGE(TAG, " Double relay assignment");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
- id: !extend init_hardware_climate
|
- id: !extend init_hardware_climate
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
@@ -197,51 +244,4 @@ script:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (current_page->state == "climate" and !id(is_uploading_tft))
|
if (current_page->state == "climate" and !id(is_uploading_tft))
|
||||||
id(is_addon_climate_visible) = embedded_climate;
|
id(is_addon_climate_visible) = embedded_climate;
|
||||||
|
|
||||||
- id: !extend watchdog
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
// Check if more than one or none of the climate options are defined
|
|
||||||
#if defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT)
|
|
||||||
#error "Invalid settings for add-on Climate. More than one option selected: Cool + Heat."
|
|
||||||
#elif defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL)
|
|
||||||
#error "Invalid settings for add-on Climate. More than one option selected: Cool + Dual."
|
|
||||||
#elif defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) && defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL)
|
|
||||||
#error "Invalid settings for add-on Climate. More than one option selected: Heat + Dual."
|
|
||||||
#elif !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL) && !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT) && !defined(NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL)
|
|
||||||
#error "Invalid settings for add-on Climate. No option selected between Cool, Heat or Dual."
|
|
||||||
#endif
|
|
||||||
if (!id(is_uploading_tft)) {
|
|
||||||
static const char *const TAG = "addon_climate_base.script.watchdog";
|
|
||||||
uint cooler_relay = ${cooler_relay};
|
|
||||||
uint heater_relay = ${heater_relay};
|
|
||||||
ESP_LOGI(TAG, "Add-on climate:");
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL
|
|
||||||
ESP_LOGI(TAG, " Cool: Enabled");
|
|
||||||
if (cooler_relay == 1 or cooler_relay == 2)
|
|
||||||
ESP_LOGI(TAG, " Relay: %u", cooler_relay);
|
|
||||||
else
|
|
||||||
ESP_LOGE(TAG, " Relay: %u", cooler_relay);
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT
|
|
||||||
ESP_LOGI(TAG, " Heat: Enabled");
|
|
||||||
if (heater_relay == 1 or heater_relay == 2)
|
|
||||||
ESP_LOGI(TAG, " Relay: %u", heater_relay);
|
|
||||||
else
|
|
||||||
ESP_LOGE(TAG, " Relay: %u", heater_relay);
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL
|
|
||||||
ESP_LOGI(TAG, " Dual: Enabled");
|
|
||||||
if (cooler_relay == 1 or cooler_relay == 2)
|
|
||||||
ESP_LOGI(TAG, " Relay (cooler): %u", cooler_relay);
|
|
||||||
else
|
|
||||||
ESP_LOGE(TAG, " Relay (cooler): %u", cooler_relay);
|
|
||||||
if (heater_relay == 1 or heater_relay == 2)
|
|
||||||
ESP_LOGI(TAG, " Relay (heater): %u", heater_relay);
|
|
||||||
else
|
|
||||||
ESP_LOGE(TAG, " Relay (heater): %u", heater_relay);
|
|
||||||
if (cooler_relay == heater_relay)
|
|
||||||
ESP_LOGE(TAG, " Double relay assignment");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -89,6 +89,16 @@ globals:
|
|||||||
initial_value: 'esphome::nextion::Nextion::TFTUploadResult::UNKNOWN'
|
initial_value: 'esphome::nextion::Nextion::TFTUploadResult::UNKNOWN'
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- id: !extend dump_config
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
if (!id(is_uploading_tft)) {
|
||||||
|
static const char *const TAG = "nspanel_ha_blueprint";
|
||||||
|
ESP_LOGCONFIG(TAG, "Add-on Upload TFT:");
|
||||||
|
ESP_LOGCONFIG(TAG, " File model: %s", tft_file_model->state.c_str());
|
||||||
|
ESP_LOGCONFIG(TAG, " Valid TFT: %s", YESNO(id(tft_is_valid)));
|
||||||
|
}
|
||||||
|
|
||||||
- id: nextion_status
|
- id: nextion_status
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
@@ -219,13 +229,20 @@ script:
|
|||||||
ESP_LOGD(TAG, "Disable BLE");
|
ESP_LOGD(TAG, "Disable BLE");
|
||||||
#ifdef USE_BLUETOOTH_PROXY
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
ESP_LOGD(TAG, " Bluetooth proxy: %s", ble_proxy->has_active() ? "Active" : "Passive");
|
ESP_LOGD(TAG, " Bluetooth proxy: %s", ble_proxy->has_active() ? "Active" : "Passive");
|
||||||
while (ble_proxy->has_active() and ble_proxy->get_bluetooth_connections_limit() != ble_proxy->get_bluetooth_connections_free()) {
|
while (ble_proxy->has_active() and
|
||||||
ESP_LOGD(TAG, " BT proxy connections: %i of %i", int(ble_proxy->get_bluetooth_connections_limit() - ble_proxy->get_bluetooth_connections_free()), int(ble_proxy->get_bluetooth_connections_limit()));
|
ble_proxy->get_bluetooth_connections_limit() != ble_proxy->get_bluetooth_connections_free()) {
|
||||||
|
ESP_LOGD(TAG, " BT proxy connections: %i of %i",
|
||||||
|
int(ble_proxy->get_bluetooth_connections_limit() - ble_proxy->get_bluetooth_connections_free()),
|
||||||
|
int(ble_proxy->get_bluetooth_connections_limit()));
|
||||||
if (ble_proxy->has_active()) {
|
if (ble_proxy->has_active()) {
|
||||||
ESP_LOGD(TAG, " BT proxy set passive mode...");
|
ESP_LOGD(TAG, " BT proxy set passive mode...");
|
||||||
ble_proxy->set_active(false);
|
ble_proxy->set_active(false);
|
||||||
}
|
}
|
||||||
|
#ifdef ARDUINO
|
||||||
|
delay(1000);
|
||||||
|
#elif defined(USE_ESP_IDF)
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
|
#endif
|
||||||
App.feed_wdt();
|
App.feed_wdt();
|
||||||
}
|
}
|
||||||
#endif // USE_BLUETOOTH_PROXY
|
#endif // USE_BLUETOOTH_PROXY
|
||||||
@@ -398,16 +415,6 @@ script:
|
|||||||
ESP_LOGI("addon_upload_tft.script.upload_tft_attempt", "Restarting ESPHome");
|
ESP_LOGI("addon_upload_tft.script.upload_tft_attempt", "Restarting ESPHome");
|
||||||
App.safe_reboot();
|
App.safe_reboot();
|
||||||
|
|
||||||
- id: !extend watchdog
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
if (!id(is_uploading_tft)) {
|
|
||||||
static const char *const TAG = "addon_upload_tft.script.watchdog";
|
|
||||||
ESP_LOGI(TAG, "Add-on Upload TFT:");
|
|
||||||
ESP_LOGI(TAG, " File model: %s", tft_file_model->state.c_str());
|
|
||||||
ESP_LOGI(TAG, " Valid TFT: %s", YESNO(id(tft_is_valid)));
|
|
||||||
}
|
|
||||||
|
|
||||||
select:
|
select:
|
||||||
- id: tft_file_model
|
- id: tft_file_model
|
||||||
name: Update TFT display - Model
|
name: Update TFT display - Model
|
||||||
|
|||||||
@@ -117,10 +117,10 @@ wifi:
|
|||||||
password: ${wifi_password}
|
password: ${wifi_password}
|
||||||
on_connect:
|
on_connect:
|
||||||
then:
|
then:
|
||||||
- script.execute: watchdog
|
- script.execute: refresh_wifi_icon
|
||||||
on_disconnect:
|
on_disconnect:
|
||||||
then:
|
then:
|
||||||
- script.execute: watchdog
|
- script.execute: refresh_wifi_icon
|
||||||
|
|
||||||
##### OTA PASSWORD #####
|
##### OTA PASSWORD #####
|
||||||
ota:
|
ota:
|
||||||
@@ -170,9 +170,31 @@ time:
|
|||||||
refresh_relays->execute(3);
|
refresh_relays->execute(3);
|
||||||
refresh_hardware_buttons_bars->execute(3);
|
refresh_hardware_buttons_bars->execute(3);
|
||||||
refresh_wifi_icon->execute();
|
refresh_wifi_icon->execute();
|
||||||
- seconds: 30
|
- seconds: 30 # Watchdog
|
||||||
then:
|
then:
|
||||||
- script.execute: watchdog
|
- lambda: |-
|
||||||
|
if (not wifi_component->is_connected()) {
|
||||||
|
ESP_LOGW("watchdog", "Retrying Wi-Fi connection");
|
||||||
|
wifi_component->retry_connect();
|
||||||
|
}
|
||||||
|
if (not api_server->is_connected() and
|
||||||
|
current_page->state != "blank" and
|
||||||
|
current_page->state != "boot" and
|
||||||
|
current_page->state != "confirm" and
|
||||||
|
current_page->state != "home" and
|
||||||
|
current_page->state != "qrcode" and
|
||||||
|
current_page->state != "screensaver" and
|
||||||
|
current_page->state != "settings") {
|
||||||
|
ESP_LOGW("watchdog", "API disconnected. Falling back to Home page.");
|
||||||
|
goto_page->execute("home");
|
||||||
|
blueprint_status->publish_state(0);
|
||||||
|
}
|
||||||
|
refresh_wifi_icon->execute();
|
||||||
|
|
||||||
|
- minutes: /10
|
||||||
|
seconds: 5
|
||||||
|
then:
|
||||||
|
- script.execute: dump_config
|
||||||
|
|
||||||
on_time_sync:
|
on_time_sync:
|
||||||
then:
|
then:
|
||||||
@@ -189,10 +211,11 @@ api:
|
|||||||
reboot_timeout: 60min
|
reboot_timeout: 60min
|
||||||
on_client_connected:
|
on_client_connected:
|
||||||
then:
|
then:
|
||||||
- script.execute: watchdog
|
- script.execute: refresh_wifi_icon
|
||||||
|
- script.execute: dump_config
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
then:
|
then:
|
||||||
- script.execute: watchdog
|
- script.execute: refresh_wifi_icon
|
||||||
services:
|
services:
|
||||||
# Dynamically configures button properties on a specified page, enhancing UI interactivity by allowing updates to button appearance and behavior based on given parameters.
|
# 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
|
- service: button # yamllint disable-line rule:indentation
|
||||||
@@ -2137,6 +2160,158 @@ script:
|
|||||||
}
|
}
|
||||||
disp1->set_component_text(component.c_str(), wrappedText.c_str());
|
disp1->set_component_text(component.c_str(), wrappedText.c_str());
|
||||||
|
|
||||||
|
- id: dump_config
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- delay: 10s
|
||||||
|
- lambda: |-
|
||||||
|
#include <esp_heap_caps.h>
|
||||||
|
static const char *const TAG = "nspanel_ha_blueprint";
|
||||||
|
if (id(is_uploading_tft)) {
|
||||||
|
ESP_LOGW(TAG, "TFT upload in progress");
|
||||||
|
} else {
|
||||||
|
// report Wi-Fi status
|
||||||
|
bool wifi_connected = wifi_component->is_connected();
|
||||||
|
if (wifi_connected) {
|
||||||
|
float rssi = wifi_rssi->state;
|
||||||
|
const char *rssi_status = "Unknown"; // Use const char* to avoid dynamic memory allocation
|
||||||
|
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_LOGCONFIG(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status, rssi);
|
||||||
|
else if (rssi > -80) ESP_LOGW(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status, rssi);
|
||||||
|
else ESP_LOGE(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status, rssi);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ESP_LOGW(TAG, "Wi-Fi: DISCONNECTED");
|
||||||
|
}
|
||||||
|
|
||||||
|
// report API status
|
||||||
|
bool api_connected = api_server->is_connected();
|
||||||
|
if (api_connected) {
|
||||||
|
ESP_LOGCONFIG(TAG, "API: Connected");
|
||||||
|
} else {
|
||||||
|
ESP_LOGW(TAG, "API: DISCONNECTED");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wifi_connected or !api_connected) blueprint_status->publish_state(0);
|
||||||
|
|
||||||
|
// Report blueprint version
|
||||||
|
ESP_LOGCONFIG(TAG, "Blueprint:");
|
||||||
|
if (blueprint_status->state > 99) {
|
||||||
|
ESP_LOGCONFIG(TAG, " Version: %s", version_blueprint->state.c_str());
|
||||||
|
ESP_LOGCONFIG(TAG, " Init steps: %i (%0.1f%%)", int(blueprint_status->raw_state), blueprint_status->state);
|
||||||
|
} else {
|
||||||
|
ESP_LOGW(TAG, " Init steps: %i (%0.1f%%)", int(blueprint_status->raw_state), blueprint_status->state);
|
||||||
|
ESP_LOGW(TAG, " State: %s", (wifi_connected and api_connected) ? "Pending" : "DISCONNECTED");
|
||||||
|
ESP_LOGCONFIG(TAG, "Requesting blueprint settings");
|
||||||
|
boot_event->execute(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Report ESPHome
|
||||||
|
ESP_LOGCONFIG(TAG, "ESPHome:");
|
||||||
|
ESP_LOGCONFIG(TAG, " Version: ${version}");
|
||||||
|
ESP_LOGCONFIG(TAG, " Compiler: %s", ESPHOME_VERSION);
|
||||||
|
// Report framework
|
||||||
|
#ifdef ARDUINO
|
||||||
|
ESP_LOGCONFIG(TAG, " Framework: Arduino");
|
||||||
|
#elif defined(USE_ESP_IDF)
|
||||||
|
ESP_LOGCONFIG(TAG, " Framework: ESP-IDF");
|
||||||
|
#endif
|
||||||
|
// Report memory
|
||||||
|
const size_t internal_heap_size = heap_caps_get_total_size(MALLOC_CAP_INTERNAL);
|
||||||
|
const size_t internal_heap_size_free = heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
|
||||||
|
ESP_LOGCONFIG(TAG, " Free heap:");
|
||||||
|
|
||||||
|
if (internal_heap_size != 0) {
|
||||||
|
ESP_LOGCONFIG(TAG, " Internal: %7d bytes (%0.1f%%)", internal_heap_size_free,
|
||||||
|
((float)internal_heap_size_free / internal_heap_size) * 100.0f);
|
||||||
|
} else {
|
||||||
|
ESP_LOGCONFIG(TAG, " Internal: %7d bytes", internal_heap_size_free);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_PSRAM
|
||||||
|
const size_t psram_heap_size = heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
|
||||||
|
const size_t psram_heap_size_free = heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
|
||||||
|
if (psram_heap_size != 0) {
|
||||||
|
ESP_LOGCONFIG(TAG, " PSRAM: %7d bytes (%0.1f%%)", psram_heap_size_free,
|
||||||
|
((float)psram_heap_size_free / psram_heap_size) * 100.0f);
|
||||||
|
} else {
|
||||||
|
ESP_LOGCONFIG(TAG, " PSRAM: %7d bytes", psram_heap_size_free);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Report UART
|
||||||
|
ESP_LOGCONFIG(TAG, "UART:");
|
||||||
|
ESP_LOGCONFIG(TAG, " Baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate());
|
||||||
|
ESP_LOGCONFIG(TAG, " Queue size: %d", tf_uart->available());
|
||||||
|
|
||||||
|
// Report Nextion status
|
||||||
|
nextion_init->publish_state(!id(is_uploading_tft) and nextion_init->state and disp1->is_setup());
|
||||||
|
ESP_LOGCONFIG(TAG, "Nextion:");
|
||||||
|
ESP_LOGCONFIG(TAG, " Queue size: %d", disp1->queue_size());
|
||||||
|
if (disp1->is_setup())
|
||||||
|
ESP_LOGCONFIG(TAG, " Is setup: True");
|
||||||
|
else {
|
||||||
|
ESP_LOGW(TAG, " Is setup: False");
|
||||||
|
ESP_LOGW(TAG, " Is detected: %s", YESNO(disp1->is_detected()));
|
||||||
|
//exit_reparse->execute();
|
||||||
|
}
|
||||||
|
if (nextion_init->state) {
|
||||||
|
ESP_LOGCONFIG(TAG, " Init: True");
|
||||||
|
} else
|
||||||
|
ESP_LOGW(TAG, " Init: False");
|
||||||
|
if (version_tft->state.empty())
|
||||||
|
ESP_LOGW(TAG, " TFT: UNKNOWN");
|
||||||
|
else
|
||||||
|
ESP_LOGCONFIG(TAG, " TFT: %s", version_tft->state.c_str());
|
||||||
|
ESP_LOGCONFIG(TAG, "Packages:");
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_CORE
|
||||||
|
ESP_LOGCONFIG(TAG, " - Core");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADVANCED
|
||||||
|
ESP_LOGCONFIG(TAG, " - Advanced");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
|
||||||
|
ESP_LOGCONFIG(TAG, " - Upload TFT");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE
|
||||||
|
ESP_LOGCONFIG(TAG, " - Climate - Base");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL
|
||||||
|
ESP_LOGCONFIG(TAG, " - Climate - Cool");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL
|
||||||
|
ESP_LOGCONFIG(TAG, " - Climate - Dual");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT
|
||||||
|
ESP_LOGCONFIG(TAG, " - Climate - Heat");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT
|
||||||
|
ESP_LOGCONFIG(TAG, " - Pre-built");
|
||||||
|
#endif
|
||||||
|
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY
|
||||||
|
ESP_LOGCONFIG(TAG, " - Pre-built (Wall Display)");
|
||||||
|
#endif
|
||||||
|
#if defined(USE_BLUETOOTH_PROXY) || defined(USE_WEBSERVER) || defined(USE_CAPTIVE_PORTAL)
|
||||||
|
ESP_LOGCONFIG(TAG, "Non-standard components:");
|
||||||
|
#ifdef USE_CAPTIVE_PORTAL
|
||||||
|
ESP_LOGCONFIG(TAG, " - Captive portal");
|
||||||
|
#endif
|
||||||
|
#ifdef USE_ESP32_BLE_CLIENT
|
||||||
|
ESP_LOGCONFIG(TAG, " - BLE tracker");
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
|
ESP_LOGCONFIG(TAG, " - Bluetooth proxy");
|
||||||
|
#endif
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
|
ESP_LOGCONFIG(TAG, " - Web server");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
- id: global_settings
|
- id: global_settings
|
||||||
mode: restart
|
mode: restart
|
||||||
parameters:
|
parameters:
|
||||||
@@ -2937,6 +3112,7 @@ script:
|
|||||||
check_versions->stop();
|
check_versions->stop();
|
||||||
display_embedded_temp->stop();
|
display_embedded_temp->stop();
|
||||||
display_wrapped_text->stop();
|
display_wrapped_text->stop();
|
||||||
|
dump_config->stop();
|
||||||
global_settings->stop();
|
global_settings->stop();
|
||||||
ha_button->stop();
|
ha_button->stop();
|
||||||
ha_call_service->stop();
|
ha_call_service->stop();
|
||||||
@@ -2988,7 +3164,6 @@ script:
|
|||||||
update_alarm_icon->stop();
|
update_alarm_icon->stop();
|
||||||
update_climate_icon->stop();
|
update_climate_icon->stop();
|
||||||
update_tft_info->stop();
|
update_tft_info->stop();
|
||||||
watchdog->stop();
|
|
||||||
|
|
||||||
###### Timers ######
|
###### Timers ######
|
||||||
- id: timer_reset_all # Global timer reset - Triggered with a touch on the screen
|
- id: timer_reset_all # Global timer reset - Triggered with a touch on the screen
|
||||||
@@ -3203,165 +3378,4 @@ script:
|
|||||||
condition:
|
condition:
|
||||||
- lambda: return (!isnan(display_charset->state) and !isnan(display_mode->state) and !(version_tft->state.empty()));
|
- lambda: return (!isnan(display_charset->state) and !isnan(display_mode->state) and !(version_tft->state.empty()));
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
|
|
||||||
- id: watchdog
|
|
||||||
mode: restart
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
#include <esp_heap_caps.h>
|
|
||||||
static const char *const TAG = "script.watchdog";
|
|
||||||
if (id(is_uploading_tft)) {
|
|
||||||
ESP_LOGW(TAG, "TFT upload in progress");
|
|
||||||
} else {
|
|
||||||
// report Wi-Fi status
|
|
||||||
bool wifi_connected = wifi_component->is_connected();
|
|
||||||
if (wifi_connected) {
|
|
||||||
float rssi = wifi_rssi->state;
|
|
||||||
const char *rssi_status = "Unknown"; // Use const char* to avoid dynamic memory allocation
|
|
||||||
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_LOGI(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status, rssi);
|
|
||||||
else if (rssi > -80) ESP_LOGW(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status, rssi);
|
|
||||||
else ESP_LOGE(TAG, "Wi-Fi: %s (%.0f dBm)", rssi_status, rssi);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ESP_LOGW(TAG, "Wi-Fi: DISCONNECTED");
|
|
||||||
ESP_LOGI(TAG, "Retrying Wi-Fi connection");
|
|
||||||
wifi_component->retry_connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
// report API status
|
|
||||||
bool api_connected = api_server->is_connected();
|
|
||||||
if (api_connected) {
|
|
||||||
ESP_LOGI(TAG, "API: Connected");
|
|
||||||
} else {
|
|
||||||
ESP_LOGW(TAG, "API: DISCONNECTED");
|
|
||||||
blueprint_status->publish_state(0);
|
|
||||||
if (current_page->state != "blank" and
|
|
||||||
current_page->state != "boot" and
|
|
||||||
current_page->state != "home" and
|
|
||||||
current_page->state != "screensaver" and
|
|
||||||
current_page->state != "settings" and
|
|
||||||
current_page->state != "qrcode") {
|
|
||||||
ESP_LOGI(TAG, "Fallback to page Home");
|
|
||||||
disp1->goto_page("home");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wifi_connected or !api_connected) blueprint_status->publish_state(0);
|
|
||||||
|
|
||||||
// Report blueprint version
|
|
||||||
ESP_LOGI(TAG, "Blueprint:");
|
|
||||||
if (blueprint_status->state > 99) {
|
|
||||||
ESP_LOGI(TAG, " Version: %s", version_blueprint->state.c_str());
|
|
||||||
ESP_LOGI(TAG, " Init steps: %i (%0.1f%%)", int(blueprint_status->raw_state), blueprint_status->state);
|
|
||||||
} else {
|
|
||||||
ESP_LOGW(TAG, " Init steps: %i (%0.1f%%)", int(blueprint_status->raw_state), blueprint_status->state);
|
|
||||||
ESP_LOGW(TAG, " State: %s", (wifi_connected and api_connected) ? "Pending" : "DISCONNECTED");
|
|
||||||
ESP_LOGI(TAG, "Requesting blueprint settings");
|
|
||||||
boot_event->execute(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Report ESPHome
|
|
||||||
ESP_LOGI(TAG, "ESPHome:");
|
|
||||||
ESP_LOGI(TAG, " Version: ${version}");
|
|
||||||
ESP_LOGI(TAG, " Compiler: %s", ESPHOME_VERSION);
|
|
||||||
// Report framework
|
|
||||||
#ifdef ARDUINO
|
|
||||||
ESP_LOGI(TAG, " Framework: Arduino");
|
|
||||||
#elif defined(USE_ESP_IDF)
|
|
||||||
ESP_LOGI(TAG, " Framework: ESP-IDF");
|
|
||||||
#endif
|
|
||||||
// Report memory
|
|
||||||
const size_t internal_heap_size = heap_caps_get_total_size(MALLOC_CAP_INTERNAL);
|
|
||||||
const size_t internal_heap_size_free = heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
|
|
||||||
ESP_LOGI(TAG, " Free heap:");
|
|
||||||
|
|
||||||
if (internal_heap_size != 0) {
|
|
||||||
ESP_LOGI(TAG, " Internal: %7d bytes (%0.1f%%)", internal_heap_size_free,
|
|
||||||
((float)internal_heap_size_free / internal_heap_size) * 100.0f);
|
|
||||||
} else {
|
|
||||||
ESP_LOGI(TAG, " Internal: %7d bytes", internal_heap_size_free);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_PSRAM
|
|
||||||
const size_t psram_heap_size = heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
|
|
||||||
const size_t psram_heap_size_free = heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
|
|
||||||
if (psram_heap_size != 0) {
|
|
||||||
ESP_LOGI(TAG, " PSRAM: %7d bytes (%0.1f%%)", psram_heap_size_free,
|
|
||||||
((float)psram_heap_size_free / psram_heap_size) * 100.0f);
|
|
||||||
} else {
|
|
||||||
ESP_LOGI(TAG, " PSRAM: %7d bytes", psram_heap_size_free);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Report UART
|
|
||||||
ESP_LOGI(TAG, "UART:");
|
|
||||||
ESP_LOGI(TAG, " Baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate());
|
|
||||||
ESP_LOGI(TAG, " Queue size: %d", tf_uart->available());
|
|
||||||
|
|
||||||
// Report Nextion status
|
|
||||||
nextion_init->publish_state(!id(is_uploading_tft) and nextion_init->state and disp1->is_setup());
|
|
||||||
ESP_LOGI(TAG, "Nextion:");
|
|
||||||
ESP_LOGI(TAG, " Queue size: %d", disp1->queue_size());
|
|
||||||
if (disp1->is_setup())
|
|
||||||
ESP_LOGI(TAG, " Is setup: True");
|
|
||||||
else {
|
|
||||||
ESP_LOGW(TAG, " Is setup: False");
|
|
||||||
ESP_LOGW(TAG, " Is detected: %s", YESNO(disp1->is_detected()));
|
|
||||||
//exit_reparse->execute();
|
|
||||||
}
|
|
||||||
if (nextion_init->state) {
|
|
||||||
ESP_LOGI(TAG, " Init: True");
|
|
||||||
} else
|
|
||||||
ESP_LOGW(TAG, " Init: False");
|
|
||||||
if (version_tft->state.empty())
|
|
||||||
ESP_LOGW(TAG, " TFT: UNKNOWN");
|
|
||||||
else
|
|
||||||
ESP_LOGI(TAG, " TFT: %s", version_tft->state.c_str());
|
|
||||||
ESP_LOGI(TAG, "Packages:");
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_CORE
|
|
||||||
ESP_LOGI(TAG, " - Core");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADVANCED
|
|
||||||
ESP_LOGI(TAG, " - Advanced");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_UPLOAD_TFT
|
|
||||||
ESP_LOGI(TAG, " - Upload TFT");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_BASE
|
|
||||||
ESP_LOGI(TAG, " - Climate - Base");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_COOL
|
|
||||||
ESP_LOGI(TAG, " - Climate - Cool");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_DUAL
|
|
||||||
ESP_LOGI(TAG, " - Climate - Dual");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_ADDON_CLIMATE_HEAT
|
|
||||||
ESP_LOGI(TAG, " - Climate - Heat");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT
|
|
||||||
ESP_LOGI(TAG, " - Pre-built");
|
|
||||||
#endif
|
|
||||||
#ifdef NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY
|
|
||||||
ESP_LOGI(TAG, " - Pre-built (Wall Display)");
|
|
||||||
#endif
|
|
||||||
#if defined(USE_BLUETOOTH_PROXY) || defined(USE_WEBSERVER) || defined(USE_CAPTIVE_PORTAL)
|
|
||||||
ESP_LOGI(TAG, "Non-standard components:");
|
|
||||||
#ifdef USE_CAPTIVE_PORTAL
|
|
||||||
ESP_LOGI(TAG, " - Captive portal");
|
|
||||||
#endif
|
|
||||||
#ifdef USE_BLUETOOTH_PROXY
|
|
||||||
ESP_LOGI(TAG, " - Bluetooth proxy");
|
|
||||||
#endif
|
|
||||||
#ifdef USE_WEBSERVER
|
|
||||||
ESP_LOGI(TAG, " - Web server");
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
refresh_wifi_icon->execute();
|
|
||||||
}
|
|
||||||
...
|
...
|
||||||
|
|||||||
Reference in New Issue
Block a user