TFT upload selectors
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# v4.2 <= pending update
|
||||
# v4.2 - Multiple alarms and dual target thermostat
|
||||
|
||||
## Support this project
|
||||
|
||||
@@ -7,12 +7,25 @@
|
||||
[](https://www.paypal.com/donate/?hosted_button_id=S974SWQMB8PB2)
|
||||
|
||||
|
||||
## 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.
|
||||
On this version we again improved the TFT upload process with a tentative to make it less painful for new and existing users. Please take a look on the new file selectors before you press the **Upload TFT** button for your new version.
|
||||
|
||||
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.
|
||||
You will also be able to set multiple alarm control panels and support to dual target temperature thermostats (including a new add-on for this).
|
||||
|
||||
And you can set more custom buttons on the Home page, set the icon size in different places, and even a clock display while sleeping. And the presentation of icons is also standardize on all the different places, improvint the usability.
|
||||
|
||||
### Important: Default framework to be changed by March 2024
|
||||
|
||||
We are planning to set `ESP-IDF`as the default framework from March 2024. This will allow more memory on the ESP available for new features to come and for your customizations.'
|
||||
|
||||
In order to change the framework, you will have to flash your device using the serial cable just like you have done when you first installed a custom firmware into your panel.
|
||||
|
||||
If for some reason you have to install a firmware via serial, please anticipate to this change and manually set `esp-idf` sooner. It's already supported.
|
||||
|
||||
And if for some reason you cannot flash via serial with the update on March, don't worry, as you will still be able to enforce the `arduino` framework on your device and flash it wirelessly (OTA).
|
||||
|
||||
More information about customizing the framework can be found in the [customization docs](docs/customization.md).
|
||||
|
||||
|
||||
## Updating
|
||||
@@ -71,8 +84,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 +120,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)>>
|
||||
|
||||
<br>
|
||||
<br>
|
||||

|
||||
|
||||
### 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.
|
||||
|
||||
|
||||
### 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`.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||
|
||||
### 7. Multiple Alarm Control Panels
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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: false
|
||||
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: false
|
||||
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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3031,7 +3031,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 +3039,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 +3051,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 +3061,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 +3069,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 +3084,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 +3118,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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
```
|
||||
|
||||
|
||||
### 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"
|
||||
```
|
||||
|
||||
|
||||
### 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).
|
||||
|
||||
|
||||
BIN
docs/pics/eu_buttonpages_icon_large.png
Normal file
BIN
docs/pics/eu_buttonpages_icon_large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
docs/pics/eu_buttonpages_icon_small.png
Normal file
BIN
docs/pics/eu_buttonpages_icon_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
docs/pics/ha_blueprint_buttons_pages_icon_size.png
Normal file
BIN
docs/pics/ha_blueprint_buttons_pages_icon_size.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
docs/pics/ha_blueprint_upload_tft_controls.png
Normal file
BIN
docs/pics/ha_blueprint_upload_tft_controls.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
Reference in New Issue
Block a user