From 55f254e7a286bc3171f5f71e4da4eedd9a51a42d Mon Sep 17 00:00:00 2001
From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com>
Date: Tue, 28 Nov 2023 16:09:39 +0100
Subject: [PATCH] Revert "Remove `esp-idf`"
This reverts commit 58d86aeb8606ed33072b3c5420d9849949cc97f5.
---
ReleaseNotes.md | 26 +++++++++++---------------
nspanel_esphome_addon_upload_tft.yaml | 8 +-------
nspanel_esphome_advanced.yaml | 6 +++---
nspanel_esphome_core.yaml | 17 +++++++++++------
4 files changed, 26 insertions(+), 31 deletions(-)
diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index 95cdd02..1e1c0c5 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -76,13 +76,11 @@ packages:
6. Buttons now will run an automation
On the previous versions, a button with an automation will enable or disable the automation. Now the button will trigger the automation.
If you want the legacy behavior, please create a script to enable/disable the automation and assign this to your button. 😉
-7. ESP-IDF IS TEMPORARILY UNAVAILABLE
-
## Overview of noteworthy changes
1. New Upload TFT engine
2. Hardware restarts with button hold for 15s
-3. ~~Support to `esp-idf` framework~~
+3. Support to `esp-idf` framework
4. Support to 921600 bps
5. Font size for chips
6. Short click to open Climate and Media Player
@@ -119,18 +117,16 @@ Now if you press the hardware buttons for more than 15s, the panel will act as t
| Right | Restarts the panel | It is equivalent to press the "Restart" button on the Settings page or from Home Assistant, but is available even when the Wi-Fi isn't connected or Home Assistant is out. |
-### 3. ~~Support to `esp-idf` framework~~
-~~Although this project still using ESPHome default framework (currently `arduino`), we started supporting the framework `esp-idf` as this is a recomendation from ESPHome team since an year ago or so.~~
-~~The `arduino` protocol still more popular and therefore more components are available, but there are some advantages with the ESP-IDF framework:~~
-- ~~It is updated more frequently by EspressIF, which means it is more secure and stable.~~
-- ~~It reduces a layer, as Arduino is developed in top of ESP-IDF, so basically we are changing from ESPHome -> Arduino -> ESP-IDF -> Hardware to ESPHome -> ESP-IDF -> Hardware.~~
-- ~~By reducing a layer, more memory is available for future features and for the custom components you might want to add to your panel.~~
-- ~~The memory management is more efficient, which makes critical tasks, like uploading a TFT file, more reliable.~~
-~~
In the future we will probably make this as the default framework, so if you are a new user or if for some reason you have to flash your panel via serial/usb, it's a good idea to change to ESP-IDF now.~~
-~~
Please look at [customizations docs in the Wiki](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-Customization#framework-esp-idf) for more details on how to change the framework.~~
-~~
-> The ESP-IDF framework will be used when you enable the advanced mode.~~
-
-> The support to IDF was temporarily removed on v4.1.2
+### 3. Support to `esp-idf` framework
+Although this project still using ESPHome default framework (currently `arduino`), we started supporting the framework `esp-idf` as this is a recomendation from ESPHome team since an year ago or so.
+The `arduino` protocol still more popular and therefore more components are available, but there are some advantages with the ESP-IDF framework:
+- It is updated more frequently by EspressIF, which means it is more secure and stable.
+- It reduces a layer, as Arduino is developed in top of ESP-IDF, so basically we are changing from ESPHome -> Arduino -> ESP-IDF -> Hardware to ESPHome -> ESP-IDF -> Hardware.
+- By reducing a layer, more memory is available for future features and for the custom components you might want to add to your panel.
+- The memory management is more efficient, which makes critical tasks, like uploading a TFT file, more reliable.
+
In the future we will probably make this as the default framework, so if you are a new user or if for some reason you have to flash your panel via serial/usb, it's a good idea to change to ESP-IDF now.
+
Please look at [customizations docs in the Wiki](https://github.com/Blackymas/NSPanel_HA_Blueprint/wiki/(EN)-Customization#framework-esp-idf) for more details on how to change the framework.
+
-> The ESP-IDF framework will be used when you enable the advanced mode.
### 4. Support to 921600 bps
diff --git a/nspanel_esphome_addon_upload_tft.yaml b/nspanel_esphome_addon_upload_tft.yaml
index 071ca88..512ecf7 100644
--- a/nspanel_esphome_addon_upload_tft.yaml
+++ b/nspanel_esphome_addon_upload_tft.yaml
@@ -13,11 +13,6 @@ substitutions:
# nextion_update_blank_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/raw/main/custom_configuration/nspanel_blank.tft"
##############################################
-#external_components:
-# - source: github://pr#5683 # Remove this when that pr is merged
-# components:
-# - nextion
-
button:
##### UPDATE TFT DISPLAY #####
- name: ${device_name} Update TFT display
@@ -94,8 +89,7 @@ script:
exit_reparse->execute();
delay_seconds_(2);
ESP_LOGV(TAG, "Calling upload from Nextion component");
- disp1->upload_tft();
- id(restart_nspanel).press();
+ if (disp1->upload_tft()) id(restart_nspanel).press();
ESP_LOGD(TAG, "Turn off Nextion");
screen_power->turn_off();
delay_seconds_(3);
diff --git a/nspanel_esphome_advanced.yaml b/nspanel_esphome_advanced.yaml
index 68c2c2d..dfb2e06 100644
--- a/nspanel_esphome_advanced.yaml
+++ b/nspanel_esphome_advanced.yaml
@@ -20,9 +20,9 @@ button:
captive_portal:
-#esp32:
-# framework:
-# type: esp-idf
+esp32:
+ framework:
+ type: esp-idf
sensor:
##### Uptime Sensors #####
diff --git a/nspanel_esphome_core.yaml b/nspanel_esphome_core.yaml
index c27403d..037f55b 100644
--- a/nspanel_esphome_core.yaml
+++ b/nspanel_esphome_core.yaml
@@ -10,6 +10,11 @@ substitutions:
version: "4.1.2"
#############################
+external_components:
+ - source: github://pr#5825 # Remove this when that pr is merged and released
+ components:
+ - nextion
+
##### ESPHOME CONFIGURATION #####
esphome:
name: ${device_name}
@@ -32,7 +37,7 @@ esphome:
- script.execute: exit_reparse
- wait_until:
condition:
- - lambda: !lambda return disp1->is_setup();
+ - lambda: !lambda return disp1->is_detected();
timeout: 20s
- lambda: |-
static const char *const TAG = "on_boot";
@@ -50,7 +55,7 @@ esphome:
};
nextion_status->execute();
- if (not disp1->is_setup()) {
+ if (not disp1->is_detected()) {
ESP_LOGE(TAG, "No response from Nextion display");
ESP_LOGD(TAG, "Turn off Nextion");
screen_power->turn_off();
@@ -62,12 +67,12 @@ esphome:
}
- wait_until:
condition:
- - lambda: !lambda return disp1->is_setup();
+ - lambda: !lambda return disp1->is_detected();
timeout: 20s
- lambda: |-
static const char *const TAG = "on_boot";
nextion_status->execute();
- if (not disp1->is_setup()) {
+ if (not disp1->is_detected()) {
ESP_LOGE(TAG, "No response from Nextion display");
}
ESP_LOGD(TAG, "Finished");
@@ -1344,7 +1349,7 @@ switch:
on_turn_on:
- wait_until:
condition:
- - lambda: !lambda return disp1->is_setup();
+ - lambda: !lambda return disp1->is_detected();
timeout: 20s
- lambda: |-
if (id(boot_sequence_completed)) {
@@ -2646,7 +2651,7 @@ script:
- lambda: |-
static const char *const TAG = "script.nextion_status";
ESP_LOGD(TAG, "Nextion status:");
- //ESP_LOGD(TAG, " Is detected: %s", disp1->is_detected() ? "True" : "False");
+ ESP_LOGD(TAG, " Is detected: %s", disp1->is_detected() ? "True" : "False");
ESP_LOGD(TAG, " Is setup: %s", disp1->is_setup() ? "True" : "False");
##### ADD-ONS ############################################################