From 692e145162e670a8b9c2694fc4feecfcd3034cf4 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:15:09 +0100 Subject: [PATCH] Remove watchdog and reduced logging Solves #1832 --- .../nspanel_esphome_addon_climate_base.yaml | 47 ----- esphome/nspanel_esphome_addon_upload_tft.yaml | 10 -- esphome/nspanel_esphome_core.yaml | 164 ++---------------- hmi/nspanel_eu.HMI | Bin 15035221 -> 15035221 bytes hmi/nspanel_us.HMI | Bin 14920032 -> 14920032 bytes 5 files changed, 17 insertions(+), 204 deletions(-) diff --git a/esphome/nspanel_esphome_addon_climate_base.yaml b/esphome/nspanel_esphome_addon_climate_base.yaml index 1613c9e..cd6279d 100644 --- a/esphome/nspanel_esphome_addon_climate_base.yaml +++ b/esphome/nspanel_esphome_addon_climate_base.yaml @@ -209,51 +209,4 @@ script: - lambda: |- if (current_page->state == "climate" and !id(is_uploading_tft)) id(is_addon_climate_visible) = embedded_climate; - - - id: !extend watchdog - then: - - lambda: |- - if (!id(is_uploading_tft)) { - static const char *const TAG = "addon_climate_base.script.watchdog"; - bool addon_climate_cool = ${addon_climate_cool}; - bool addon_climate_heat = ${addon_climate_heat}; - bool addon_climate_dual = ${addon_climate_dual}; - uint cooler_relay = ${cooler_relay}; - uint heater_relay = ${heater_relay}; - ESP_LOGI(TAG, "Add-on climate:"); - if (addon_climate_cool) { - ESP_LOGI(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled"); - if (cooler_relay == 1 or cooler_relay == 2) - ESP_LOGI(TAG, " Relay: %u", cooler_relay); - else - ESP_LOGE(TAG, " Relay: %u", cooler_relay); - } - if (addon_climate_heat) { - ESP_LOGI(TAG, " Heat: %s", addon_climate_heat ? "Enabled" : "Disabled"); - if (heater_relay == 1 or heater_relay == 2) - ESP_LOGI(TAG, " Relay: %u", heater_relay); - else - ESP_LOGE(TAG, " Relay: %u", heater_relay); - } - if (addon_climate_dual) { - ESP_LOGI(TAG, " Dual: %s", addon_climate_dual ? "Enabled" : "Disabled"); - 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"); - } - - if ((addon_climate_cool && addon_climate_heat) || - (addon_climate_cool && addon_climate_dual) || - (addon_climate_heat && addon_climate_dual) || - (!addon_climate_cool && !addon_climate_heat && !addon_climate_dual)) { - ESP_LOGE(TAG, "Invalid settings for add-on Climate"); - } - } ... diff --git a/esphome/nspanel_esphome_addon_upload_tft.yaml b/esphome/nspanel_esphome_addon_upload_tft.yaml index 5bb5694..638de29 100644 --- a/esphome/nspanel_esphome_addon_upload_tft.yaml +++ b/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -365,16 +365,6 @@ script: ESP_LOGI("addon_upload_tft.script.upload_tft_attempt", "Restarting ESPHome"); 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: - id: tft_file_model name: Update TFT display - Model diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index cf8b208..ae53e87 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -24,11 +24,11 @@ substitutions: ##### External components ##### external_components: - source: - type: local - path: /Blackymas/esphome/components/nspanel_ha_blueprint - #type: git - #url: https://github.com/Blackymas/NSPanel_HA_Blueprint - #ref: dev # To do: Change it for releasing + #type: local + #path: packages/Blackymas/components + type: git + url: https://github.com/Blackymas/NSPanel_HA_Blueprint + ref: dev # To do: Change it for releasing components: - nspanel_ha_blueprint refresh: 3s # To do: Change it for releasing @@ -109,12 +109,6 @@ wifi: ap: ssid: "${name}" password: ${ap_password} - on_connect: - then: - - script.execute: watchdog - on_disconnect: - then: - - script.execute: watchdog ##### OTA PASSWORD ##### ota: @@ -164,8 +158,6 @@ time: then: - script.execute: refresh_datetime - seconds: 30 - then: - - script.execute: watchdog on_time_sync: then: @@ -176,10 +168,6 @@ time: api: id: api_server reboot_timeout: 60min - on_client_connected: - - script.execute: watchdog - on_client_disconnected: - - script.execute: watchdog 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 @@ -1170,14 +1158,6 @@ binary_sensor: lambda: |- return disp1->is_setup(); - ##### API connection status - - name: Status - platform: status - id: api_status - on_state: - then: - - script.execute: watchdog - ##### START - BUTTON CONFIGURATION ##### button: ###### Factory Reset button ##### @@ -2413,22 +2393,22 @@ script: - lambda: |- if (not id(is_uploading_tft)) { if (display_mode->state == 3) { // US Landscape model - if (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button - disp1->fill_area(467, 174, 3, 118, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(468, 173, 1, 120, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button + disp1->fill_area(467, 174, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(468, 173, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); } - if (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button - disp1->fill_area(467, 28, 3, 118, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(468, 27, 1, 120, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button + disp1->fill_area(467, 28, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(468, 27, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); } } else { // US Portrait and EU models - if (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button - disp1->fill_area(48, 307, 118, 3, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(47, 308, 120, 1, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button + disp1->fill_area(48, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(47, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); } - if (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button - disp1->fill_area(289, 307, 118, 3, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(288, 308, 120, 1, (id(button_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button + disp1->fill_area(289, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(288, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); } } } @@ -2887,7 +2867,6 @@ script: timer_sleep->stop(); update_alarm_icon->stop(); update_climate_icon->stop(); - watchdog->stop(); ESP_LOGD(TAG, "Finished"); ###### Timers ###### @@ -3103,113 +3082,4 @@ script: disp1->set_component_font_color(component.c_str(), 1530); // cyan break; } - - - id: watchdog - mode: restart - then: - - script.execute: refresh_relays - - lambda: |- - static const char *const TAG = "script.watchdog"; - ESP_LOGV(TAG, "Starting"); - 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; - 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_LOGI(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_LOGE(TAG, "Wi-Fi: DISCONNECTED"); - } - - // report API status - bool api_connected = api_server->is_connected(); - if (api_connected) { - ESP_LOGI(TAG, "API: Connected"); - } else { - ESP_LOGE(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"); - goto_page->execute("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", id(version_blueprint)); - 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"); - auto ha_event = new esphome::api::CustomAPIDevice(); - ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", - { - {"type", "boot"}, - {"step", "timeout"} - }); - } - - // Report ESPHome - ESP_LOGI(TAG, "ESPHome:"); - ESP_LOGI(TAG, " Version: ${version}"); - // Report framework - #ifdef ARDUINO - ESP_LOGI(TAG, " Framework: Arduino"); - size_t total_heap_size = ESP.getHeapSize(); - size_t free_heap_size = ESP.getFreeHeap(); - #elif defined(USE_ESP_IDF) - ESP_LOGI(TAG, " Framework: ESP-IDF"); - size_t total_heap_size = heap_caps_get_total_size(MALLOC_CAP_DEFAULT); - size_t free_heap_size = esp_get_free_heap_size(); - #endif - if (total_heap_size != 0) - ESP_LOGI(TAG, " Heap: %zu bytes (%d%%)", free_heap_size, - int(round(((float)free_heap_size / total_heap_size) * 100.0f))); - - // 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(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())); - } - 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()); - } - refresh_wifi_icon->execute(); - ESP_LOGV(TAG, "Finished"); ... diff --git a/hmi/nspanel_eu.HMI b/hmi/nspanel_eu.HMI index bf1b7140a4b47a3927eeca4e8cbc1f8e43821978..58d9700360429c99f94c81690f0e3a34a862d9a4 100644 GIT binary patch delta 2031 zcmd_r`%_e97zgm@?2WVta@t)iY=Y^glA%r`P$8HXNE8!6F(4=?C7`9{qFjXFQLqb8 zo4$lpCd5?)V)2lck-=H9inG^2SVjao3+Yjl|To2Fn|$Evd!vMcj^D|jFoP` zDz~2mI?#gwj9`-8eqO#m{TCYg+Y=NkK0Y+Vtl@@6ex06 z+ReiEM6pE*7Li@~4PrDaKU1!`+umysXHuKIs~UsskO%ot0EMsxwn7mULkX0^HYkH~ zcpfUC5*W6_4yb}^*a3^h;-b?^$j3J!P;cEN5CP!F#|1MGoDcmv*qw_q>4 z4f~)8n&BO2fmUdPcIbdk*biNB0J@Un6;kZnM7gOck;@-m8ekdIe(khpBzY3s;4qf)9E{jiq)q0*;*bA z(iX%76BVdEM;B^2WRaE+glYMXa4k1PYT0+0mUl$q|EHcn7o*+j)>y6n*IF&-CTKmE z5{X*X8>&qvx=Vd4{rFO}tM!x&qG~l?+(gu&=DIARk;(qa=TFSV7e$@8l1F4xU%Rn@ z=!)n45E%-I+SK~~E$U*-<>Le7*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