9 Commits

Author SHA1 Message Date
Edward Firmo
4979fe856e Update nspanel_esphome_prebuilt.bin 2024-01-03 23:54:29 +01:00
Edward Firmo
beae026a0b Rebuilt nspanel_us files
Solves #1509
2024-01-03 23:52:40 +01:00
Edward Firmo
3ba64b6108 Add SSID to wifi change instructions
Solves #1476
2024-01-03 23:28:59 +01:00
Edward Firmo
ffa34d67bd Rebuilt nspanel_CJK_eu.hmi
Solves #1513
The TFT was also re-generated, but has no difference to the previous one.
2024-01-03 23:19:11 +01:00
Edward Firmo
5be3692ab6 Remember wake-up page after power cycle
Solves #1520
2024-01-03 23:10:22 +01:00
Edward Firmo
10eed8723e Refining release notes 2024-01-03 22:13:17 +01:00
Edward Firmo
1afbb79402 Update ReleaseNotes.md 2024-01-03 21:47:14 +01:00
Edward Firmo
289eb8e395 Fix links 2024-01-03 20:32:20 +01:00
Edward Firmo
30ed450a4f TFT upload selectors 2024-01-03 20:16:33 +01:00
19 changed files with 268 additions and 152 deletions

View File

@@ -2,8 +2,6 @@ substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_update_url: "https://github.com/Blackymas/NSPanel_HA_Blueprint/dummy"
nextion_update_blank_url: "http://homeassistant.local:8123/local/nspanel/dev/nspanel_blank.tft"
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
@@ -32,21 +30,6 @@ binary_sensor:
bluetooth_proxy:
button:
##### UPDATE TFT BLANK DISPLAY #####
#- name: ${device_name} Update TFT display (blank)
# platform: template
# icon: mdi:file-sync
# id: tft_update_blank
# entity_category: config
# on_press:
# - logger.log: "Button pressed: Update TFT display (blank)"
# - binary_sensor.template.publish:
# id: nextion_init
# state: false
# - delay: 16ms
# - lambda: |-
# id(disp1)->set_tft_url("${nextion_update_blank_url}");
# id(disp1).upload_tft();
# Adds a button to put the panel to sleep
- name: ${device_name} Sleep
id: force_sleep

View File

@@ -1,4 +1,4 @@
# v4.2 <= pending update
# v4.2 - Multi-Alarm Control, Dual Thermostat Functionality, and More!
## Support this project
@@ -7,12 +7,26 @@
[![Paypal](https://user-images.githubusercontent.com/41958506/212499642-b2fd097a-0938-4bfc-b37b-74df64592c58.png)](https://www.paypal.com/donate/?hosted_button_id=S974SWQMB8PB2)
&nbsp;
## General <= pending update
The focus this time was on making easier to transfer the TFT files.
## General
As this project grows with features, it becomes more hungry of resources from all sides (ESPHome, your Home Assistant server and even the Nextion display) and with that the chances of something going wrong when updating increased.
Hello everyone! In our latest update, we've made some great strides to enhance your experience. We've fine-tuned the TFT upload process, making it smoother and more user-friendly for both newbies and veterans.
So at this release we concentrated on cleaning up de code everywhere and shave some unnecessary elements, making the system easier to install and opening some space for future features. But you still can find a couple of nice new things not related to the cleaning.
Exciting news we've introduced multiple alarm control panels and added support for dual target temperature thermostats, complete with a handy new add-on.
On top of that, you've got more customization freedom now. Play around with additional custom buttons and icon size settings on your Home and button pages. Oh, and don't miss the new clock feature on the sleep page it's a small but nifty addition!
Dive into the details below and see how these improvements can upgrade your day-to-day. Looking forward to your feedback!
### Upcoming Change: Switching to ESP-IDF Framework by March 2024
Exciting news for our community in just a couple of months, by March 2024, we'll be transitioning to the **ESP-IDF** as our default framework. This upgrade is designed to significantly increase the available memory on the ESP, making more room for new features and your customizations.
While the change is around the corner, there's no need to rush. You have time to get ready for this transition. When it's time to switch, youll need to flash your device using a serial cable, similar to what you did for your first custom firmware installation.
If you happen to need a serial firmware installation before March, consider giving `esp-idf` a try earlier. Its already supported and a good step towards future-proofing your setup.
And if you're not able to make the switch by March or can't flash via serial, don't worry. Youll still have the option to use the `arduino` framework and update your device wirelessly (OTA).
For all the details on customizing the framework, our [customization docs](docs/customization.md#framework-esp-idf) are there to help. We're committed to making this transition as smooth as possible, so reach out if you have any concerns or need assistance.
&nbsp;
## Updating
@@ -64,6 +78,8 @@ wifi:
As multiple alarms are supported now, the system don't know which one to show on the wake-up.
11. **Changes in icon presentation.**<br>
As part of our efforts to standardize icons across various pages, you might notice some differences in how they appear and behave. This includes new colors for lights and climate icons, as well as the introduction of new icon designs. While many aspects can still be customized through blueprint settings, the default presentation will now adhere to this new standardized format. These changes might be a departure from what you're accustomed to in previous versions, but they aim to enhance overall consistency and user experience.
12. ***Action required:* Reset your wake-up page selection.**<br>
We've enhanced the wake-up page functionality for improved consistency after power cycles. Previously, the system didn't remember your selection following a power outage. With our latest update, this issue has been resolved. However, this improvement requires you to reselect your wake-up page one more time. Thanks for your cooperation in making these settings more reliable for everyday use.
&nbsp;
## Overview of noteworthy changes
@@ -71,8 +87,8 @@ wifi:
2. Additional custom buttons on Home page
3. Outdoor temperature selectable font size
4. Select icon size for button's pages
5. Support to Chinese (Taiwan) and prepared for other CJK languages
6. Upload baud rate selectable as substitution
5. Support to CJK languages (experimental)
6. Improved TFT transfer
7. Multiple Alarm Control Panels
8. Support to `remote`
9. Home page chips now supports covers
@@ -107,28 +123,40 @@ Now you can select the font size of your outdoor temperature display:
### 4. Select icon size for button's pages
You can also select the size of the icons on the buttos pages:
<<add blueprint screenshot>>
<<add page screenshot (US and EU)>>
![HA Blueprint - Buttons pages icon's size](docs/pics/ha_blueprint_buttons_pages_icon_size.png)<br>
![EU Buttons pages - Small icons](docs/pics/eu_buttonpages_icon_small.png)<br>
![EU Buttons pages - Large icons](docs/pics/eu_buttonpages_icon_large.png)
&nbsp;
### 5. Support to Chinese (Taiwan) and prepared for other CJK languages
### 5. Support to CJK languages (experimental)
You will find 3 new TFT files on the repository for the CJK languages. These files are considerably bigger, as the fonts requires more memory, but it should work fine in your panel.
Currently only translations to Chinese (Taiwan) are available, but as soon we get the strings for other languages we will be happy to add to the blueprint selection.
<< Add screenshots of blueprint >>
**ATTENTION:** This is an experimental feature and may contain bugs or some areas missing translations. Please report if you find anything.
&nbsp;
### 6. Upload baud rate selectable as substitution
### 6. Improved TFT transfer
#### TFT file selectors
We still working on the Upload TFT engine to make it easier for new and for experienced users. Now, together with the **Update TFT Display** button, you will find also **Update TFT Display - Model** and **Update TFT Display - Branch** (disabled by default) where you can select the different model you are using and the upload URL will be automatically adjusted to donwload the file directly from the repository on GitHub, making this process much easier and removing the need of flashing your device every time you want to play with another TFT file or install the `nspanel_blank.tft`.
![HA Blueprint - Update TFT controls](docs/pics/ha_blueprint_upload_tft_controls.png)
If you have issues with the remote file and want to transfer it from your local server just as before, simply select **Use nextion_update_url** in **Update TFT Display - Model**.
#### Alternative baud rate for TFT uploads
You can select an alternative baud rate for your TFT uploads. This allows faster TFT uploads and also supports displays previously set with baud rates not supported by this project (currently 115200 bps and 921600 bps).
To enable an alternative upload TFT baud rate, add the desired value in your substitutions like this:
In most cases, this would be set for a higher value to enable faster TFT transfer. The default is 921600 bps, the maximum supported by Nextion displays.
You can also use this if you have issues with TFT transfer and want to try a lower baud rate as in some rare cases Nextion will automatically set itself to 9600 bps.
To enable an alternative upload TFT baud rate, add the desired value in your substitutions like this:
```yaml
upload_tft_baud_rate: "921600"
upload_tft_baud_rate: "9600"
```
If an invalid value is entered or this substitution is not present, the current baud rate will be used.
If an invalid value is entered, 115200 bps will be used. The default value for this substitution (in case it is not set by users) will be 921600 bps.
The system will always fall back to the standard baud rate (115200 bps) if other tentatives fails.
During a TFT transfer, the system will always fall back to the standard baud rate (115200 bps) if other tentatives fails.
&nbsp;
### 7. Multiple Alarm Control Panels

View File

@@ -174,35 +174,35 @@ script:
- id: !extend watchdog
then:
- lambda: |-
static const char *const TAG = "script.watchdog (add-on climate)";
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_LOGD(TAG, "Add-on climate:");
ESP_LOGI(TAG, "Add-on climate:");
if (addon_climate_cool) {
ESP_LOGD(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled");
ESP_LOGI(TAG, " Cool: %s", addon_climate_cool ? "Enabled" : "Disabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGD(TAG, " Relay: %i", cooler_relay);
ESP_LOGI(TAG, " Relay: %i", cooler_relay);
else
ESP_LOGE(TAG, " Relay: %i", cooler_relay);
}
if (addon_climate_heat) {
ESP_LOGD(TAG, " Heat: %s", addon_climate_heat ? "Enabled" : "Disabled");
ESP_LOGI(TAG, " Heat: %s", addon_climate_heat ? "Enabled" : "Disabled");
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGD(TAG, " Relay: %i", heater_relay);
ESP_LOGI(TAG, " Relay: %i", heater_relay);
else
ESP_LOGE(TAG, " Relay: %i", heater_relay);
}
if (addon_climate_dual) {
ESP_LOGD(TAG, " Dual: %s", addon_climate_dual ? "Enabled" : "Disabled");
ESP_LOGI(TAG, " Dual: %s", addon_climate_dual ? "Enabled" : "Disabled");
if (cooler_relay == 1 or cooler_relay == 2)
ESP_LOGD(TAG, " Relay (cooler): %i", cooler_relay);
ESP_LOGI(TAG, " Relay (cooler): %i", cooler_relay);
else
ESP_LOGE(TAG, " Relay (cooler): %i", cooler_relay);
if (heater_relay == 1 or heater_relay == 2)
ESP_LOGD(TAG, " Relay (heater): %i", heater_relay);
ESP_LOGI(TAG, " Relay (heater): %i", heater_relay);
else
ESP_LOGE(TAG, " Relay (heater): %i", heater_relay);
if (cooler_relay == heater_relay)

View File

@@ -10,16 +10,27 @@
substitutions:
################## Defaults ##################
# Just in case user forgets to set something #
nextion_update_url: "http://github.com/Blackymas/NSPanel_HA_Blueprint/raw/main/custom_configuration/nspanel_eu.tft"
nextion_blank_url: "http://github.com/Blackymas/NSPanel_HA_Blueprint/raw/main/custom_configuration/nspanel_blank.tft"
nextion_update_url: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/main/nspanel_eu.tft"
nextion_update_base_url: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/"
##############################################
##### DON'T CHANGE THIS #####
upload_tft_chunk_size_max: "32768"
upload_tft_baud_rate: "0"
upload_tft_baud_rate: "921600"
#############################
api:
on_client_connected:
- delay: 15s
- lambda: |-
static const char *const TAG = "addon_upload_tft.esphome.on_boot";
ESP_LOGI(TAG, "TFT URL: %s", id(tft_url).c_str());
ESP_LOGI(TAG, "Substitutions:");
ESP_LOGI(TAG, " nextion_update_url: ${nextion_update_url}");
ESP_LOGI(TAG, " nextion_update_base_url: ${nextion_update_base_url}");
ESP_LOGI(TAG, " upload_tft_chunk_size_max: ${upload_tft_chunk_size_max}");
ESP_LOGI(TAG, " upload_tft_baud_rate: ${upload_tft_baud_rate}");
services:
##### SERVICE TO UPDATE THE TFT FILE from URL #####
##### It will use the default url if url is empty or "default"
@@ -28,7 +39,7 @@ api:
url: string
then:
- lambda: |-
static const char *const TAG = "service.upload_tft_url";
static const char *const TAG = "addon_upload_tft.service.upload_tft_url";
ESP_LOGVV(TAG, "Starting...");
std::string clean_url = url;
@@ -41,7 +52,7 @@ api:
clean_url = clean_url.substr(0, endPos + 1);
}
if (clean_url.empty() or clean_url == "default") url = "${nextion_update_url}";
if (clean_url.empty() or clean_url == "default") url = id(tft_url);
upload_tft->execute(url.c_str());
button:
@@ -53,9 +64,9 @@ button:
entity_category: config
on_press:
- lambda: |-
static const char *const TAG = "button.tft_update.on_press";
static const char *const TAG = "addon_upload_tft.button.tft_update.on_press";
ESP_LOGD(TAG, "Update TFT display button pressed");
upload_tft->execute("${nextion_update_url}");
upload_tft->execute(id(tft_url).c_str());
display:
- id: !extend disp1
@@ -83,6 +94,11 @@ globals:
restore_value: false
initial_value: '0'
- id: tft_url
type: std::string
restore_value: false
initial_value: '"${nextion_update_url}"'
script:
- id: exit_reparse_v414
mode: restart
@@ -101,7 +117,7 @@ script:
command: string
then:
- lambda: |-
static const char *const TAG = "script.nextion_uart_command";
static const char *const TAG = "addon_upload_tft.script.nextion_uart_command";
if (disp1->is_setup()) {
ESP_LOGD(TAG, "Sending `%s` directly to Nextion", command.c_str());
disp1->send_command_printf(command.c_str());
@@ -113,28 +129,11 @@ script:
}
App.feed_wdt();
- id: report_upload_progress
mode: restart
parameters:
message: string
then:
- lambda: |-
static const char *const TAG = "script.report_upload_progress";
ESP_LOGD(TAG, "%s", message.c_str());
if (id(tft_is_valid)) {
if (page_id->state != 26) {
open_upload_dialog->execute();
}
display_wrapped_text->execute("confirm.body", message.c_str(), 18);
disp1->set_backlight_brightness(1);
App.feed_wdt();
}
- id: nextion_upload
mode: single
then:
- lambda: |-
static const char *const TAG = "script.nextion_upload";
static const char *const TAG = "addon_upload_tft.script.nextion_upload";
ESP_LOGD(TAG, "Waiting for empty UART and Nextion queues");
- wait_until:
condition:
@@ -143,7 +142,7 @@ script:
timeout: 10s
- delay: 2s
- lambda: |-
static const char *const TAG = "script.nextion_upload";
static const char *const TAG = "addon_upload_tft.script.nextion_upload";
ESP_LOGD(TAG, "Starting TFT upload...");
if (disp1->upload_tft()) App.safe_reboot();
@@ -151,7 +150,7 @@ script:
mode: restart
then:
- lambda: |-
static const char *const TAG = "script.open_upload_dialog";
static const char *const TAG = "addon_upload_tft.script.open_upload_dialog";
ESP_LOGD(TAG, "Showing upload dialog page");
disp1->goto_page("confirm");
disp1->hide_component("bt_close");
@@ -165,6 +164,63 @@ script:
#endif
page_id->update();
- id: report_upload_progress
mode: restart
parameters:
message: string
then:
- lambda: |-
static const char *const TAG = "addon_upload_tft.script.report_upload_progress";
ESP_LOGD(TAG, "%s", message.c_str());
if (id(tft_is_valid)) {
if (page_id->state != 26) {
open_upload_dialog->execute();
}
display_wrapped_text->execute("confirm.body", message.c_str(), 18);
disp1->set_backlight_brightness(1);
App.feed_wdt();
}
- id: set_tft_file
mode: restart
parameters:
model: string
branch: string
then:
- lambda: |-
static const char *const TAG = "addon_upload_tft.script.set_tft_file";
ESP_LOGD(TAG, "A new TFT was selected:");
ESP_LOGD(TAG, " Model: %s", model.c_str());
ESP_LOGD(TAG, " Branch: %s", branch.c_str());
if (id(is_uploading_tft))
ESP_LOGW(TAG, "TFT Upload in progress.");
else {
std::string url;
std::string file_name;
if (model == "NSPanel Blank") file_name = "nspanel_blank.tft";
else if (model == "NSPanel EU") file_name = "nspanel_eu.tft";
else if (model == "NSPanel US") file_name = "nspanel_us.tft";
else if (model == "NSPanel US Landscape") file_name = "nspanel_us_land.tft";
else if (model == "NSPanel EU (CJK languages)") file_name = "advanced/hmi/nspanel_CJK_eu.tft";
else if (model == "NSPanel US (CJK languages)") file_name = "advanced/hmi/nspanel_CJK_us.tft";
else if (model == "NSPanel US Landscape (CJK languages)") file_name = "advanced/hmi/nspanel_CJK_us_land.tft";
if (file_name.empty()) url = "${nextion_update_url}";
else {
std::string base_url("${nextion_update_base_url}");
url = base_url + branch + "/" + file_name;
// Remove trailing slashes or spaces
auto endPos = url.find_last_not_of(" /");
if (std::string::npos != endPos) {
url = url.substr(0, endPos + 1);
}
ESP_LOGD(TAG, "Full URL: %s", url.c_str());
id(tft_url) = url;
disp1->set_tft_url(url.c_str());
}
}
- id: upload_tft # I've changed this to use ESPHome commands to avoid the parallelism from lambdas
mode: single
parameters:
@@ -177,9 +233,11 @@ script:
then:
- switch.turn_on: screen_power
- delay: 5s
# Wait for recent changes to TFT url
- script.wait: set_tft_file
# Then start the upload
- lambda: |-
static const char *const TAG = "script.upload_tft";
static const char *const TAG = "addon_upload_tft.script.upload_tft";
ESP_LOGD(TAG, "Starting...");
id(is_uploading_tft) = true;
@@ -449,7 +507,7 @@ script:
### This code should never run
- delay: 2s
- lambda: |-
static const char *const TAG = "script.upload_tft";
static const char *const TAG = "addon_upload_tft.script.upload_tft";
ESP_LOGD(TAG, "Finishing...");
id(is_uploading_tft) = false;
screen_power->publish_state(true);
@@ -461,7 +519,7 @@ script:
url: string
then:
- lambda: |-
static const char *const TAG = "script.upload_tft_v414";
static const char *const TAG = "addon_upload_tft.script.upload_tft_v414";
ESP_LOGD(TAG, "Trying to upload TFT");
id(tft_upload_try)++;
char update_msg[128];
@@ -473,7 +531,7 @@ script:
- lambda: !lambda return (!id(tft_is_valid));
timeout: 1s
- lambda: |-
static const char *const TAG = "script.upload_tft_v414";
static const char *const TAG = "addon_upload_tft.script.upload_tft_v414";
ESP_LOGD(TAG, "Starting...");
std::vector<uint8_t> buffer_;
@@ -509,7 +567,7 @@ script:
auto send_nextion_command = [](const std::string &command) -> bool
{
static const char *const TAG = "script.upload_tft.send_nextion_command";
static const char *const TAG = "addon_upload_tft.script.upload_tft.send_nextion_command";
ESP_LOGD(TAG, "Sending: %s", command.c_str());
id(tf_uart).write_str(command.c_str());
const uint8_t to_send[3] = {0xFF, 0xFF, 0xFF};
@@ -704,7 +762,7 @@ script:
};
auto upload_tft_ = [&](const std::string &url, unsigned int update_baud_rate_) -> bool
{
static const char *const TAG = "script.upload_tft.upload_tft_arduino";
static const char *const TAG = "addon_upload_tft.script.upload_tft.upload_tft_arduino";
ESP_LOGD(TAG, "Nextion TFT upload requested");
ESP_LOGD(TAG, " url: %s", url.c_str());
ESP_LOGD(TAG, " baud_rate: %i", update_baud_rate_);
@@ -864,7 +922,7 @@ script:
};
#elif defined(ESP_PLATFORM) // esp-idf # To do: Move to Nextion component on ESPHome
auto upload_range_esp_idf_ = [&](const std::string &url, int range_start) -> int {
static const char *const TAG = "script.upload_tft.upload_range_esp_idf_";
static const char *const TAG = "addon_upload_tft.script.upload_tft.upload_range_esp_idf_";
ESP_LOGVV(TAG, "url: %s", url.c_str());
uint range_size_ = tft_size_ - range_start;
ESP_LOGVV(TAG, "tft_size_: %i", tft_size_);
@@ -970,7 +1028,7 @@ script:
return range_end + 1;
};
auto upload_tft_ = [&](const std::string &url, unsigned int update_baud_rate_) -> bool {
static const char *const TAG = "script.upload_tft.upload_tft_esp_idf";
static const char *const TAG = "addon_upload_tft.script.upload_tft.upload_tft_esp_idf";
ESP_LOGD(TAG, "Nextion TFT upload requested");
ESP_LOGD(TAG, " url: %s", url.c_str());
ESP_LOGD(TAG, " baud_rate: %i", update_baud_rate_);
@@ -1132,6 +1190,48 @@ script:
report_upload_progress->execute(update_msg);
- script.wait: report_upload_progress
select:
- id: tft_file
name: ${device_name} Update TFT display - Model
platform: template
options:
- "Use nextion_update_url"
- "NSPanel Blank"
- "NSPanel EU"
- "NSPanel US"
- "NSPanel US Landscape"
- "NSPanel EU (CJK languages)"
- "NSPanel US (CJK languages)"
- "NSPanel US Landscape (CJK languages)"
initial_option: "Use nextion_update_url"
optimistic: true
restore_value: true
internal: false
entity_category: config
disabled_by_default: false
icon: mdi:file-sync
set_action:
- lambda: set_tft_file->execute(x.c_str(), tft_file_branch->state.c_str());
- script.wait: set_tft_file
- id: tft_file_branch
name: ${device_name} Update TFT display - Branch
platform: template
options:
- "main"
- "beta"
- "dev"
initial_option: "main"
optimistic: true
restore_value: true
internal: false
entity_category: config
disabled_by_default: true
icon: mdi:file-sync
set_action:
- lambda: set_tft_file->execute(tft_file->state.c_str(), x.c_str());
- script.wait: set_tft_file
sensor:
- id: !extend display_mode
on_value:

View File

@@ -19,7 +19,7 @@ substitutions:
##### External components #####
external_components:
- source: github://pr#6029 # Remove this when that PR is released (Hopefully v2024.1.0)
- source: github://pr#6051 # Remove this when that PR is released (Hopefully v2024.1.0)
components:
- nextion
@@ -37,6 +37,9 @@ esphome:
static const char *const TAG = "on_boot";
ESP_LOGD(TAG, "After boot check-up starting");
set_baud_rate->execute(stoi(baud_rate->state), true);
- select.set:
id: wakeup_page_name
option: !lambda return id(page_names)[id(wakeup_page_id)].c_str();
on_shutdown:
then:
- switch.turn_off: screen_power
@@ -455,12 +458,12 @@ api:
reset_timer: bool
then:
- lambda: |-
if (current_page->state == "screensaver") disp1->goto_page(wakeup_page_name->state.c_str());
if (current_page->state == "screensaver") disp1->goto_page(id(wakeup_page_id));
if (reset_timer)
timer_reset_all->execute(wakeup_page_name->state.c_str());
timer_reset_all->execute(id(page_names)[id(wakeup_page_id)].c_str());
else {
timer_sleep->execute(wakeup_page_name->state.c_str(), int(timeout_sleep->state));
timer_dim->execute(wakeup_page_name->state.c_str(), int(timeout_dim->state));
timer_sleep->execute(id(page_names)[id(wakeup_page_id)].c_str(), int(timeout_sleep->state));
timer_dim->execute(id(page_names)[id(wakeup_page_id)].c_str(), int(timeout_dim->state));
}
#### Service to set the entities ####
@@ -719,6 +722,11 @@ display:
##### START - GLOBALS CONFIGURATION #####
globals:
##### Wake-up page id #####
- id: wakeup_page_id
type: uint
restore_value: true
initial_value: '0'
##### Wi-Fi timeout #####
- id: wifi_timeout
@@ -1248,11 +1256,15 @@ select:
- qrcode
initial_option: home
optimistic: true
restore_value: true
restore_value: false
internal: false
entity_category: config
icon: mdi:page-next-outline
set_action:
- lambda: |-
static const char *const TAG = "select.wakeup_page_name";
ESP_LOGD(TAG, "New wake-up page selected: %s", x.c_str());
set_page_id->execute("wakeup_page_id", x.c_str());
- script.execute: page_screensaver
##### START - SENSOR CONFIGURATION #####
@@ -1441,7 +1453,7 @@ switch:
- lambda: |-
if (id(setup_sequence_completed)) {
nextion_init->publish_state(disp1->is_setup());
disp1->goto_page(wakeup_page_name->state.c_str());
disp1->goto_page(id(wakeup_page_id));
}
on_turn_off:
- lambda: |-
@@ -1869,9 +1881,9 @@ script:
- rtttl.play:
rtttl: 'two short:d=4,o=5,b=100:16e6,16e6'
- lambda: |-
ESP_LOGD("script.global_settings", "Jump to wake-up page: %s", wakeup_page_name->state.c_str());
disp1->goto_page(wakeup_page_name->state.c_str());
timer_reset_all->execute(wakeup_page_name->state.c_str());
ESP_LOGD("script.global_settings", "Jump to wake-up page: %s", id(page_names)[id(wakeup_page_id)].c_str());
disp1->goto_page(id(wakeup_page_id));
timer_reset_all->execute(id(page_names)[id(wakeup_page_id)].c_str());
- lambda: |-
ESP_LOGV("script.global_settings", "Finished");
@@ -2202,7 +2214,7 @@ script:
if (current_page->state == "screensaver" and not id(is_uploading_tft)) {
static const char *const TAG = "script.page_screensaver";
ESP_LOGV(TAG, "Updating screensaver page");
set_page_id->execute("back_page_id", wakeup_page_name->state.c_str());
disp1->send_command_printf("back_page_id=%i", id(wakeup_page_id));
set_component_color->execute("screensaver.text",id(screensaver_display_time_color));
refresh_datetime->execute();
}
@@ -2573,7 +2585,10 @@ script:
uint detected_page_id = pageIndex(page.c_str());
ESP_LOGV(TAG, "%s=%i", variable.c_str(), detected_page_id);
disp1->send_command_printf("%s=%i", variable.c_str(), detected_page_id);
if (variable == "wakeup_page_id")
id(wakeup_page_id) = detected_page_id;
else
disp1->send_command_printf("%s=%i", variable.c_str(), detected_page_id);
- id: setup_sequence
mode: restart
@@ -2720,7 +2735,7 @@ script:
state: boot
timeout: 10s
- lambda: |-
if (current_page->state == "boot") disp1->goto_page(wakeup_page_name->state.c_str());
if (current_page->state == "boot") disp1->goto_page(id(wakeup_page_id));
else: # Unknown TFT
- lambda: |-
static const char *const TAG = "script.setup_sequence";
@@ -3031,7 +3046,7 @@ script:
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);
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);
}
@@ -3039,7 +3054,7 @@ script:
ESP_LOGW(TAG, "Wi-Fi: DISCONNECTED");
if (id(wifi_timeout) > 0) {
id(wifi_timeout)--;
ESP_LOGD(TAG, "Retrying Wi-Fi connection");
ESP_LOGI(TAG, "Retrying Wi-Fi connection");
wifi_component->retry_connect();
} else {
ESP_LOGE(TAG, "Restarting ESP due to a Wi-Fi timeout...");
@@ -3051,7 +3066,7 @@ script:
bool previous_blueprint_status = id(is_blueprint_updated);
bool api_connected = api_server->is_connected();
if (api_connected) {
ESP_LOGD(TAG, "API: Connected");
ESP_LOGI(TAG, "API: Connected");
} else {
ESP_LOGW(TAG, "API: DISCONNECTED");
id(is_blueprint_updated) = false;
@@ -3061,7 +3076,7 @@ script:
current_page->state != "screensaver" and
current_page->state != "settings" and
current_page->state != "qrcode") {
ESP_LOGD(TAG, "Fallback to page Home");
ESP_LOGI(TAG, "Fallback to page Home");
disp1->goto_page("home");
}
}
@@ -3069,10 +3084,10 @@ script:
// Report blueprint version
id(is_blueprint_updated) = id(is_blueprint_updated) and wifi_connected and api_connected and (not id(version_blueprint).empty());
if (id(is_blueprint_updated))
ESP_LOGD(TAG, "Blueprint: %s", id(version_blueprint).c_str());
ESP_LOGI(TAG, "Blueprint: %s", id(version_blueprint).c_str());
else {
ESP_LOGW(TAG, "Blueprint: %s", (wifi_connected and api_connected) ? "Pending" : "DISCONNECTED");
ESP_LOGD(TAG, "Requesting blueprint settings");
ESP_LOGI(TAG, "Requesting blueprint settings");
auto ha_event = new esphome::api::CustomAPIDevice();
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
@@ -3084,33 +3099,33 @@ script:
refresh_wifi_icon->execute();
// Report ESPHome
ESP_LOGD(TAG, "ESPHome:");
ESP_LOGD(TAG, " Version: ${version}");
ESP_LOGI(TAG, "ESPHome:");
ESP_LOGI(TAG, " Version: ${version}");
// Report framework
#ifdef ARDUINO
ESP_LOGD(TAG, " Framework: arduino");
ESP_LOGI(TAG, " Framework: arduino");
#elif defined(USE_ESP_IDF)
ESP_LOGD(TAG, " Framework: esp-idf");
ESP_LOGI(TAG, " Framework: esp-idf");
#endif
// Report UART
ESP_LOGD(TAG, "UART:");
ESP_LOGD(TAG, " Baud rate: %d bps", tf_uart->get_baud_rate());
ESP_LOGD(TAG, " Queue size: %d", tf_uart->available());
ESP_LOGI(TAG, "UART:");
ESP_LOGI(TAG, " Baud rate: %d 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_LOGD(TAG, "Nextion:");
ESP_LOGD(TAG, " Queue size: %d", disp1->queue_size());
ESP_LOGI(TAG, "Nextion:");
ESP_LOGI(TAG, " Queue size: %d", disp1->queue_size());
if (disp1->is_setup())
ESP_LOGD(TAG, " Is setup: True");
ESP_LOGI(TAG, " Is setup: True");
else {
ESP_LOGW(TAG, " Is setup: False");
ESP_LOGW(TAG, " Is detected: %s", disp1->is_detected() ? "True" : "False");
//exit_reparse->execute();
}
if (nextion_init->state) {
ESP_LOGD(TAG, " Init: True");
ESP_LOGI(TAG, " Init: True");
// Update api value on Nextion
if (id(is_blueprint_updated) != previous_blueprint_status) disp1->send_command_printf("api=%i", id(is_blueprint_updated) ? 1 : 0);
} else
@@ -3118,7 +3133,7 @@ script:
if (version_tft->state.empty())
ESP_LOGW(TAG, " TFT: UNKNOWN");
else
ESP_LOGD(TAG, " TFT: %s", version_tft->state.c_str());
ESP_LOGI(TAG, " TFT: %s", version_tft->state.c_str());
}
ESP_LOGV(TAG, "Finished");

View File

@@ -9,7 +9,6 @@ substitutions:
device_name: nspanel
wifi_ssid: nspanel
wifi_password: NSPanel_Blueprint
nextion_update_url: "http://github.com/Blackymas/NSPanel_HA_Blueprint/raw/main/nspanel_blank.tft"
pre_built: "true"
packages:
@@ -17,8 +16,6 @@ packages:
upload_tft_package: !include ./nspanel_esphome_addon_upload_tft.yaml # Core package
button:
- id: !remove tft_update
- platform: factory_reset
name: Factory reset
disabled_by_default: true
@@ -56,6 +53,27 @@ logger:
ota:
password: ""
script:
- id: !extend watchdog
then:
- lambda: |-
static const char *const TAG = "prebuilt.script.watchdog";
ESP_LOGI(TAG, "Pre-built version: ${pre_built}");
select:
- id: !extend tft_file
platform: template
options:
- "NSPanel Blank"
- "NSPanel EU"
- "NSPanel US"
- "NSPanel US Landscape"
- "NSPanel EU (CJK languages)"
- "NSPanel US (CJK languages)"
- "NSPanel US Landscape (CJK languages)"
initial_option: "NSPanel Blank"
wifi:
ap: {}
power_save_mode: LIGHT # To make it compatible with BLE

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -13,7 +13,6 @@ Table of contents:
- [Connect to multiple networks](#connect-to-multiple-networks)
- [SNTP (time) server](#sntp-time-server)
- [Sensor for display awake vs sleeping](#sensor-for-display-awake-vs-sleeping)
- [Button to upload `nspanel_blank.tft`](#button-to-upload-nspanel_blanktft)
- [Deep sleep](#deep-sleep)
- [Enforce time zone](#enforce-time-zone)
- [Compiling ESPHome on lower powered machines](#compiling-esphome-on-lower-powered-machines)
@@ -221,33 +220,6 @@ binary_sensor:
return (id(current_page).state == "screensaver");
```
&nbsp;
### Button to upload `nspanel_blank.tft`
This can also be used for any other alternative tft file you might want to use frequently:
```yaml
button:
##### UPDATE TFT BLANK DISPLAY #####
- name: ${device_name} Update TFT display (blank)
platform: template
icon: mdi:file-sync
id: tft_update_blank
entity_category: config
on_press:
- logger.log: "Button pressed: Update TFT display (blank)"
- binary_sensor.template.publish:
id: nextion_init
state: false
- delay: 16ms
- lambda: |-
id(disp1)->set_tft_url("${nextion_blank_url}");
id(disp1).upload_tft();
```
You also must add the url for the alternative tft in your substitutions, like this:
```yaml
nextion_blank_url: "http://homeassistant.local:8123/local/nspanel_blank.tft"
```
&nbsp;
### Deep sleep
In this example, the panel will deep sleep for 7 hours, starting at 23:00:00 every day, for its maximum energy saving.
@@ -478,7 +450,7 @@ time:
The `arduino` protocol still more popular and therefore more components are available, but as `esp-idf` is maintained by EspressIF and is kept updated, more boards are supported and the memory management is better, making it ideal if you wanna customize your panel to support memory consumption functionalities, like `bluetooth_proxy` or [Improv](https://www.improv-wifi.com/).
This project uses `arduino` as default framework. The advanced package changes it to `esp-idf`. In any case, you can overlap the settings with this customization.
This project currently uses `arduino` as default framework, but we are planning to set `esp-idf` as default from March 2024. In any case, you can overlap the settings with this customization.
For more info about frameworks, please visit [ESPHome docs](https://esphome.io/components/esp32).

View File

@@ -17,7 +17,7 @@ Below are the topics covered in this document, each with relevant tips and solut
1. [Call a page directly](#Call-a-page-directly)
1. [Play RTTTL Sound](#play-rtttl-sound)
1. [Start automations via Input_Boolean](#Start-automations-via-input_boolean)
1. [Updating Wi-Fi and OTA passwords in ESPHome with this project](#updating-wi-fi-and-ota-passwords-in-esphome-with-this-project)
1. [Updating Wi-Fi and OTA passwords in ESPHome with this project](#updating-wi-fi-settings-and-ota-passwords-in-esphome-with-this-project)
## How to create "issues" when I have a problem
@@ -245,7 +245,7 @@ Now add the created Input_Boolean as a trigger in the desired automation under S
In the last step, assign the trigger to a button in the Panel Config:![Toggle3](./(DE)-HowTo---Alle-wichtigen-Dinge-die-man-wissen-sollte.assets/Toggle3.PNG)
## Updating Wi-Fi and OTA Passwords in ESPHome with This Project
## Updating Wi-Fi settings and OTA Passwords in ESPHome with This Project
#### Overview
When you update your Wi-Fi password in a device with firmware from our project, it's important to remember that the `wifi_password` substitution is used for both Wi-Fi and OTA updates (and a few more places that are not relevant now). Failing to update both simultaneously can lead to connection issues.
@@ -271,21 +271,21 @@ When you update your Wi-Fi password in a device with firmware from our project,
```
- Flash your device. It will use the current password for this flash and will inform your device to start using the new password for the next OTA.
- When your device starts, **remove the lines above**.
- Find the `wifi_password` key in the `substitutions` area (usually at the beginning of the file) and change it to your new Wi-Fi password.
- Flash your device again with the updated YAML. It will use the current Wi-Fi to connect to your device and the new Wi-Fi password as the OTA password, then will inform your device to connect to the Wi-Fi with the new password.
- Find the `wifi_ssid` and `wifi_password` key in the `substitutions` area (usually at the beginning of the file) and change it to your new Wi-Fi password. If that is point to `!secret`, you will have to edit it in your `secrets.yaml` file instead.
- Flash your device again with the updated YAML. It will use the current Wi-Fi to connect to your device and the new Wi-Fi password as the OTA password, then will inform your device to connect to the Wi-Fi with the new settings.
3. **Update Wi-Fi Password in Your Access Point**
3. **Update Wi-Fi Settings in Your Access Point**
#### Important Notes
- The device will still be using the old Wi-Fi password for this update. If you've already changed your Wi-Fi network password, this step will fail.
- The device will still be using the old Wi-Fi settings for this update. If you've already changed your Wi-Fi network settings, this step will fail.
- **Troubleshooting: Unable to Connect via Wi-Fi**
- If your device cannot connect to Wi-Fi due to a password change, you will need to flash the device via a serial connection.
- If your device cannot connect to Wi-Fi due to a password or SSID change, you will need to flash the device via a serial connection.
- Connect your device to your computer using a USB-to-Serial adapter.
- Use the ESPHome flasher tool to upload the new configuration.
- In this case, don't worry about the OTA password, as it's not required when flashing via serial.
#### Verify the Update
- Once the new configuration is uploaded, your device should automatically connect to your Wi-Fi network with the new password.
- Once the new configuration is uploaded, your device should automatically connect to your Wi-Fi network with the new settings.
- Verify that OTA updates are working with the new password.
#### Additional Tips
@@ -294,4 +294,4 @@ When you update your Wi-Fi password in a device with firmware from our project,
- **Serial Flashing:** Familiarize yourself with the process of flashing via serial, as it's a reliable fallback method.
#### Conclusion
By carefully updating both your Wi-Fi and OTA passwords in your ESPHome configuration, you can avoid connection issues. Remember to always back up your configuration and be prepared to use a serial connection if Wi-Fi connectivity is lost.
By carefully updating both your Wi-Fi settings and OTA passwords in your ESPHome configuration, you can avoid connection issues. Remember to always back up your configuration and be prepared to use a serial connection if Wi-Fi connectivity is lost.

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Binary file not shown.