Merge pull request #1386 from Blackymas/beta

v4.1.4 - Supports Home Assistant 2023.12.0
This commit is contained in:
Edward Firmo
2023-12-05 18:51:35 +01:00
committed by GitHub
146 changed files with 19672 additions and 40707 deletions

View File

@@ -3,10 +3,12 @@ name: Validate ESPHome
on:
push:
paths:
- "nspanel_esphome*.yaml"
- "nspanel_esphome.yaml"
- "advanced/esphome/nspanel_esphome*.yaml"
pull_request:
paths:
- "nspanel_esphome*.yaml"
- "nspanel_esphome.yaml"
- "advanced/esphome/nspanel_esphome*.yaml"
#schedule:
# - cron: "0 0 * * *"
workflow_dispatch:
@@ -25,11 +27,11 @@ jobs:
- name: Validate nspanel_esphome.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome.yaml
- name: Validate nspanel_esphome_advanced.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_advanced.yaml
run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_advanced.yaml
- name: Validate nspanel_esphome_addon_climate_cool.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_cool.yaml
run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_cool.yaml
- name: Validate nspanel_esphome_addon_climate_heat.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_heat.yaml
run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
build_core:
name: Core

View File

@@ -4,7 +4,8 @@ on:
workflow_dispatch:
pull_request:
paths:
- "nspanel_esphome*.yaml"
- "nspanel_esphome.yaml"
- "advanced/esphome/nspanel_esphome*.yaml"
#schedule:
#- cron: "0 0 * * *"
@@ -22,11 +23,11 @@ jobs:
- name: Validate nspanel_esphome.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome.yaml
- name: Validate nspanel_esphome_advanced.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_advanced.yaml
run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_advanced.yaml
- name: Validate nspanel_esphome_addon_climate_cool.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_cool.yaml
run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_cool.yaml
- name: Validate nspanel_esphome_addon_climate_heat.yaml
run: yamllint -c "./.yamllint/rules.yml" nspanel_esphome_addon_climate_heat.yaml
run: yamllint -c "./.yamllint/rules.yml" advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
build_core:
name: Core
@@ -108,18 +109,18 @@ jobs:
yaml_file: "./.test/esphome_advanced_climate_cool_esp_idf.yaml"
version: beta
build_climate_cool_advanced_esp_idf5:
name: esp-idf v5 & Bluetooth proxy
runs-on: "ubuntu-latest"
needs:
- build_climate_cool_advanced_esp_idf
steps:
- uses: actions/checkout@v4.1.0
- name: Build core+advanced+climate_cool+esp_idf5
uses: esphome/build-action@v1.8.0
with:
yaml_file: "./.test/esphome_advanced_climate_cool_esp_idf5.yaml"
version: beta
#build_climate_cool_advanced_esp_idf5:
# name: esp-idf v5 & Bluetooth proxy
# runs-on: "ubuntu-latest"
# needs:
# - build_climate_cool_advanced_esp_idf
# steps:
# - uses: actions/checkout@v4.1.0
# - name: Build core+advanced+climate_cool+esp_idf5
# uses: esphome/build-action@v1.8.0
# with:
# yaml_file: "./.test/esphome_advanced_climate_cool_esp_idf5.yaml"
# version: beta
build_climate_heat_advanced_customization:
name: Customizations

View File

@@ -6,6 +6,6 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml
advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml

View File

@@ -6,9 +6,9 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml
advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml
esp32:
framework:

View File

@@ -6,9 +6,9 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml
advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml
esp32:
framework:

View File

@@ -6,6 +6,6 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cold: !include ../nspanel_esphome_addon_climate_cold.yaml
advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cold: !include ../advanced/esphome/nspanel_esphome_addon_climate_cold.yaml

View File

@@ -7,9 +7,9 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
advanced_package: !include ../nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cold: !include ../nspanel_esphome_addon_climate_cold.yaml
advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cold: !include ../advanced/esphome/nspanel_esphome_addon_climate_cold.yaml
##### Customizations from Wiki #####
api:

View File

@@ -6,6 +6,6 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
#advanced_package: !include ../nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml
#advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml

View File

@@ -6,6 +6,6 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
#advanced_package: !include ../nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml
#advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml

View File

@@ -6,6 +6,6 @@ substitutions:
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
#advanced_package: !include ../nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cool: !include ../nspanel_esphome_addon_climate_cool.yaml
#advanced_package: !include ../advanced/esphome/nspanel_esphome_advanced.yaml
#addon_climate_heat: !include ../advanced/esphome/nspanel_esphome_addon_climate_heat.yaml
#addon_climate_cool: !include ../advanced/esphome/nspanel_esphome_addon_climate_cool.yaml

View File

@@ -19,9 +19,9 @@ So at this release we concentrated on cleaning up de code everywhere and shave s
Since in this update lots of input to the blueprint changed, we highly recommend you review your settings and make sure all fields have the correct selection. We did our best to support your legacy settings and avoid breaking your system, but please double check your settings if you see something not working as expected.
### Files that need to be reloaded:
1. nspanel_eu.tft, nspanel_us.tft or nspanel_us_land.tft - v4.1.2
2. nspanel_esphome.yaml - v4.1.2
3. nspanel_blueprint.yaml - v4.1.2
1. nspanel_eu.tft, nspanel_us.tft or nspanel_us_land.tft - v4.1.4
2. nspanel_esphome.yaml - v4.1.4
3. nspanel_blueprint.yaml - v4.1.4
####
@@ -103,6 +103,10 @@ packages:
- Upload TFT remove dependency to from ESPHome Nextion component
- Fix light icon color on buttons
- Fix climate page not updating properly
- 4.1.4 patch:
- Supports new `weather.get_forecasts` introduced by Home Assistant 2023.12.0
- Manual line break on multiline text with `\r`
- Upload TFT user's interface on the panel
 
## Details of noteworthy changes

View File

@@ -1,7 +1,11 @@
####################################################################################################
##### NSPanel ESPHome Add-on for Climate control - Shared - This will be called by heat/cool #####
##### Add-on for https://github.com/Blackymas/NSPanel_HA_Blueprint #####
####################################################################################################
#####################################################################################################
##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint #####
##### ESPHome Add-on for Climate control - Shared - This will be called by heat/cool #####
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
#####################################################################################################
substitutions:
### Local thermostat defaults ###

View File

@@ -0,0 +1,37 @@
#####################################################################################################
##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint #####
##### ESPHome Add-on for Climate control - Cool #####
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
#####################################################################################################
substitutions:
### Local thermostat defaults ###
# https://esphome.io/components/climate/thermostat.html
cooler_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled
# https://esphome.io/components/climate/index.html#base-climate-configuration
temp_min: "15"
temp_max: "45"
##### DO NOT CHANGE THIS #####
addon_climate_cool: "true"
addon_climate_heat: "false"
##############################
climate:
- id: !extend thermostat_embedded
min_cooling_off_time: ${min_off_time}s
min_cooling_run_time: ${min_run_time}s
cool_action:
- switch.turn_on: relay_${cooler_relay}
preset:
- name: "Off"
default_target_temperature_high: ${temp_min} ${temp_units}
mode: "off"
- name: Home
default_target_temperature_high: 21 ${temp_units}
packages:
core_package: !include nspanel_esphome_addon_climate_base.yaml

View File

@@ -0,0 +1,37 @@
#####################################################################################################
##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint #####
##### ESPHome Add-on for Climate control - Heat #####
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
#####################################################################################################
substitutions:
### Local thermostat defaults ###
# https://esphome.io/components/climate/thermostat.html
heater_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled
# https://esphome.io/components/climate/index.html#base-climate-configuration
temp_min: "5"
temp_max: "25"
##### DO NOT CHANGE THIS #####
addon_climate_cool: "false"
addon_climate_heat: "true"
##############################
climate:
- id: !extend thermostat_embedded
min_heating_off_time: ${min_off_time}s
min_heating_run_time: ${min_run_time}s
heat_action:
- switch.turn_on: relay_${heater_relay}
preset:
- name: "Off"
default_target_temperature_low: ${temp_min} ${temp_units}
mode: "off"
- name: Home
default_target_temperature_low: 21 ${temp_units}
packages:
core_package: !include nspanel_esphome_addon_climate_base.yaml

View File

@@ -4,6 +4,8 @@
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
##### ATTENTION: This will add advanced elements to the core system and requires the core part. #####
#####################################################################################################
substitutions:
@@ -138,20 +140,6 @@ script:
static const char *const TAG = "script.upload_tft";
ESP_LOGD(TAG, "Starting...");
nextion_init->publish_state(false);
disp1->set_backlight_brightness(1);
disp1->hide_component("255");
stop_all->execute();
std::vector<uint8_t> buffer_;
bool is_updating_ = false;
bool upload_first_chunk_sent_ = false;
int content_length_ = 0;
int tft_size_ = 0;
auto delay_seconds_ = [](int seconds) {
ESP_LOGD(TAG, "Wait %i seconds", seconds);
for (int i = 0; i < (seconds*4); i++) {
@@ -164,6 +152,54 @@ script:
}
};
std::string framework = "Unknown";
#ifdef ARDUINO
framework = "Arduino";
#elif defined(ESP_PLATFORM)
framework = "ESP-IDF";
#endif
if (disp1->is_setup()) {
disp1->set_backlight_brightness(1);
disp1->set_component_text_printf("confirm.title", "Upload TFT\\r%s", framework.c_str());
disp1->set_component_text_printf("confirm.body", "Preparing...");
disp1->goto_page("confirm");
disp1->hide_component("bt_close");
disp1->hide_component("bt_accept");
disp1->hide_component("bt_clear");
disp1->hide_component("bt_close");
delay_seconds_(1);
display_wrapped_text->execute("confirm.body", "Informing the blueprint that panel is unavailable...", 18);
disp1->hide_component("bt_close");
}
nextion_init->publish_state(false);
if (disp1->is_setup()) {
delay_seconds_(1);
display_wrapped_text->execute("confirm.body", "Stopping scripts...", 18);
}
stop_all->execute();
if (disp1->is_setup()) delay_seconds_(1);
std::vector<uint8_t> buffer_;
bool is_updating_ = false;
bool upload_first_chunk_sent_ = false;
int content_length_ = 0;
int tft_size_ = 0;
auto set_baud_rate_ = [](int baud_rate) {
#ifdef USE_ARDUINO
auto *uart = reinterpret_cast<uart::ESP32ArduinoUARTComponent *>(tf_uart);
#endif
#ifdef USE_ESP_IDF
auto *uart = reinterpret_cast<uart::IDFUARTComponent *>(tf_uart);
#endif
uart->set_baud_rate(baud_rate);
uart->setup();
};
auto send_nextion_command = [](const std::string &command) -> bool
{
static const char *const TAG = "script.upload_tft.send_nextion_command";
@@ -363,8 +399,8 @@ script:
{
static const char *const TAG = "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_);
ESP_LOGD(TAG, " url: %s", url.c_str());
ESP_LOGD(TAG, " baud_rate: %i", update_baud_rate_);
if (is_updating_) {
ESP_LOGD(TAG, "Currently updating");
@@ -440,8 +476,9 @@ script:
// Tells the Nextion the content length of the tft file and baud rate it will be sent at
// Once the Nextion accepts the command it will wait until the file is successfully uploaded
// If it fails for any reason a power cycle of the display will be needed
sprintf(command, "whmi-wris %d,%" PRIu32 ",1", content_length_, update_baud_rate_);
sprintf(command, "whmi-wris %d,%d,1", content_length_, update_baud_rate_);
ESP_LOGD(TAG, "Clear serial receive buffer: %d", id(tf_uart).available());
// Clear serial receive buffer
uint8_t d;
while (id(tf_uart).available()) {
@@ -450,16 +487,16 @@ script:
send_nextion_command(command);
if (update_baud_rate_ != id(tf_uart).get_baud_rate())
{
id(tf_uart).set_baud_rate(update_baud_rate_);
id(tf_uart).setup();
if (update_baud_rate_ != id(tf_uart).get_baud_rate()) {
set_baud_rate_(update_baud_rate_);
//id(tf_uart).set_baud_rate(update_baud_rate_);
//id(tf_uart).setup();
//delay_seconds_(2);
}
std::string response;
ESP_LOGD(TAG, "Waiting for upgrade response");
recv_ret_string_(response, 2000, true); // This can take some time to return
std::string response;
recv_ret_string_(response, 5000, true); // This can take some time to return
// The Nextion display will, if it's ready to accept data, send a 0x05 byte.
ESP_LOGD(TAG, "Upgrade response is [%s]",
format_hex_pretty(reinterpret_cast<const uint8_t *>(response.data()), response.size()).c_str());
@@ -628,8 +665,8 @@ script:
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";
ESP_LOGD(TAG, "Nextion TFT upload requested");
ESP_LOGD(TAG, "url: %s", url.c_str());
ESP_LOGD(TAG, "baud_rate: %i", update_baud_rate_);
ESP_LOGD(TAG, " url: %s", url.c_str());
ESP_LOGD(TAG, " baud_rate: %i", update_baud_rate_);
if (is_updating_) {
ESP_LOGW(TAG, "Currently updating");
@@ -711,10 +748,10 @@ script:
send_nextion_command(command);
if (update_baud_rate_ != id(tf_uart).get_baud_rate())
{
id(tf_uart).set_baud_rate(update_baud_rate_);
id(tf_uart).setup();
if (update_baud_rate_ != id(tf_uart).get_baud_rate()) {
set_baud_rate_(update_baud_rate_);
//id(tf_uart).set_baud_rate(update_baud_rate_);
//id(tf_uart).setup();
}
std::string response;
@@ -759,35 +796,42 @@ script:
};
#endif
unsigned int upload_tries = 0;
while (upload_tries < 5) {
upload_tries++;
ESP_LOGD(TAG, "Try #%i", upload_tries);
if (upload_tft_(url, id(tf_uart).get_baud_rate())) id(restart_nspanel).press();
ESP_LOGD(TAG, "Turn off Nextion");
id(screen_power).turn_off();
delay_seconds_(2);
ESP_LOGD(TAG, "Turn on Nextion");
id(screen_power).turn_on();
delay_seconds_(5);
ESP_LOGD(TAG, "Try #1 at 921600 bps");
if (disp1->is_setup()) {
display_wrapped_text->execute("confirm.body", "Try #1 at 921600 bps", 18);
delay_seconds_(1);
}
unsigned int new_baud_rate;
if (id(tf_uart).get_baud_rate() == 115200) {
new_baud_rate = 921600;
} else {
new_baud_rate = 115200;
if (upload_tft_(url, 921600)) id(restart_nspanel).press();
ESP_LOGW(TAG, "Try #1 failed");
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #1 failed", 18);
delay_seconds_(5);
ESP_LOGD(TAG, "Try #2 at 921600 bps");
if (upload_tft_(url, 921600)) id(restart_nspanel).press();
ESP_LOGW(TAG, "Try #2 failed");
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #2 failed", 18);
delay_seconds_(5);
ESP_LOGD(TAG, "Try #3 at 115200 bps");
if (upload_tft_(url, 115200)) id(restart_nspanel).press();
ESP_LOGW(TAG, "Try #3 failed");
if (disp1->is_setup()) {
display_wrapped_text->execute("confirm.body", "Try #3 failed. Restarting display.", 18);
delay_seconds_(3);
}
ESP_LOGD(TAG, "Trying again at %i bps", new_baud_rate);
if (upload_tft_(url, new_baud_rate)) {
id(restart_nspanel).press();
}
ESP_LOGE(TAG, "TFT upload failed.");
ESP_LOGD(TAG, "Turn off Nextion");
id(screen_power).turn_off();
delay_seconds_(2);
ESP_LOGD(TAG, "Turn on Nextion");
id(screen_power).turn_on();
ESP_LOGD(TAG, "Restarting esphome");
delay_seconds_(10);
ESP_LOGD(TAG, "Try #4 at 115200 bps");
if (upload_tft_(url, 115200)) id(restart_nspanel).press();
ESP_LOGE(TAG, "TFT upload failed");
ESP_LOGD(TAG, "Turn off Nextion");
id(screen_power).turn_off();
delay_seconds_(2);
ESP_LOGD(TAG, "Turn on Nextion");
id(screen_power).turn_on();
ESP_LOGD(TAG, "Restarting ESPHome");
delay_seconds_(2);
id(restart_nspanel).press();

View File

@@ -1,6 +1,6 @@
#####################################################################################################
##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint #####
##### ADVANCED CONFIG + FULL ESPHOME CODE! #####
##### ESPHOME ADVANCED #####
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
@@ -84,10 +84,6 @@ time:
- component.update: api_timestamp
- component.update: device_timestamp
uart:
- id: !extend tf_uart
baud_rate: 921600
web_server:
id: web_server_std
port: 80

View File

@@ -1,13 +1,13 @@
#####################################################################################################
##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint #####
##### ADVANCED CONFIG + FULL ESPHOME CODE! #####
##### ESPHOME CORE #####
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
substitutions:
##### DON'T CHANGE THIS #####
version: "4.1.3"
version: "4.1.4"
#############################
#external_components:
@@ -68,7 +68,7 @@ esphome:
- wait_until:
condition:
- lambda: !lambda return disp1->is_setup();
timeout: 45s
timeout: 20s
- lambda: |-
static const char *const TAG = "on_boot";
nextion_status->execute();
@@ -226,6 +226,9 @@ api:
// Alarm page - Header
update_alarm_icon->execute("icon_state", state.c_str());
if (page_title.find("\\r") != std::string::npos) {
page_title = page_title.replace(page_title.find("\\r"), 2, " ");
}
disp1->set_component_text_printf("page_label", "%s", page_title.c_str());
disp1->set_component_text_printf("code_format", "%s", code_format.c_str());
if (code_arm_required) disp1->set_component_text_printf("code_arm_req", "1"); else disp1->set_component_text_printf("code_arm_req", "0");
@@ -432,6 +435,9 @@ api:
detailed_entity->publish_state(entity);
std::string cmd_page = std::string("page ") + page.c_str();
disp1->send_command_printf(cmd_page.c_str());
if (page_label.find("\\r") != std::string::npos) {
page_label = page_label.replace(page_label.find("\\r"), 2, " ");
}
disp1->set_component_text_printf("page_label", "%s", page_label.c_str());
disp1->set_component_text_printf("back_page", "%s", back_page.c_str());
if (page == "climate")
@@ -2094,23 +2100,27 @@ script:
int startPos = 0;
int endPos = 0;
std::string wrappedText = "";
while (startPos < text_to_display.length()) {
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
int endPos = startPos + line_length_limit;
if (endPos >= text_to_display.length()) endPos = text_to_display.length();
else
{
while (endPos > startPos && text_to_display[endPos] != ' ') { endPos--; }
if (endPos == startPos) endPos = startPos + line_length_limit; // Handle case of long word
}
wrappedText += text_to_display.substr(startPos, endPos-startPos);
if (endPos < text_to_display.length())
{
while (text_to_display[endPos] == ' ') { endPos--; }
if (endPos >= startPos) wrappedText += "\\r";
}
startPos = endPos + 1; // Skip the space
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
if (text_to_display.find("\\r") != std::string::npos) {
wrappedText = text_to_display;
} else {
while (startPos < text_to_display.length()) {
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
int endPos = startPos + line_length_limit;
if (endPos >= text_to_display.length()) endPos = text_to_display.length();
else
{
while (endPos > startPos && text_to_display[endPos] != ' ') { endPos--; }
if (endPos == startPos) endPos = startPos + line_length_limit; // Handle case of long word
}
wrappedText += text_to_display.substr(startPos, endPos-startPos);
if (endPos < text_to_display.length())
{
while (text_to_display[endPos] == ' ') { endPos--; }
if (endPos >= startPos) wrappedText += "\\r";
}
startPos = endPos + 1; // Skip the space
while (text_to_display[startPos] == ' ' and startPos < text_to_display.length()) { startPos++; }
}
}
disp1->set_component_text_printf(component.c_str(), "%s", wrappedText.c_str());

View File

@@ -142,7 +142,7 @@ Text tft_version
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : 4.1.3
Text : 4.1.4
Max. Text Size : 9
Text esph_version

View File

@@ -109,7 +109,7 @@ Text body
Send Component ID : disabled
Associated Keyboard: none
Text : Please confirm
Max. Text Size : 22
Max. Text Size : 254
Events
Touch Press Event

View File

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 120 B

View File

@@ -142,7 +142,7 @@ Text tft_version
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : 4.1.3
Text : 4.1.4
Max. Text Size : 9
Text esph_version

View File

@@ -109,7 +109,7 @@ Text body
Send Component ID : disabled
Associated Keyboard: none
Text : Please confirm
Max. Text Size : 22
Max. Text Size : 254
Events
Touch Press Event

View File

@@ -142,7 +142,7 @@ Text tft_version
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : 4.1.3
Text : 4.1.4
Max. Text Size : 9
Text esph_version

View File

@@ -109,7 +109,7 @@ Text body
Send Component ID : disabled
Associated Keyboard: none
Text : Please confirm
Max. Text Size : 22
Max. Text Size : 254
Events
Touch Press Event

Some files were not shown because too many files have changed in this diff Show More