Merge pull request #1668 from Blackymas/dev

v4.2.3 to beta
This commit is contained in:
Edward Firmo
2024-01-17 19:30:04 +01:00
committed by GitHub
186 changed files with 1582 additions and 613 deletions

View File

@@ -3,7 +3,7 @@ name: Bug Report
description: |
We aim to keep everything running smoothly.
Please fill out the form with details to help us identify and address the issue.
title: "`BUG` "
title: ""
labels: [Bug]
body:
- type: markdown

View File

@@ -1,6 +1,9 @@
---
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: Discussions area
url: https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions
about: This is your go-to space for community conversations, questions, idea sharing, and collaboration around our project.
- name: Troubleshooting TFT Transfer
url: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/tft_upload.md
about: Try this guide first if you are having issues to transfer a TFT file.

View File

@@ -1,7 +1,7 @@
---
name: Enhancement Request
description: Suggest an idea for this project
title: "`ENHANCEMENT` "
title: ""
labels: [Enhancement]
body:
- type: markdown

View File

@@ -1,7 +1,7 @@
---
name: Question
description: Ask a question about this project
title: "`QUESTION` "
title: ""
labels: [Question]
body:
- type: markdown

View File

@@ -7,10 +7,12 @@ on:
paths:
- "nspanel_esphome*.yaml"
- "advanced/esphome/nspanel_esphome*.yaml"
- ".test/*.yaml"
pull_request:
paths:
- "nspanel_esphome*.yaml"
- "advanced/esphome/nspanel_esphome*.yaml"
- ".test/*.yaml"
workflow_dispatch:
concurrency:

2
.gitignore vendored
View File

@@ -12,4 +12,4 @@ Nextion2Text.*
# Ignore dev folder
#dev
nspanel_esphome_prebuilt.bin
nspanel_esphome_prebuilt*.bin

View File

@@ -3,6 +3,7 @@ substitutions:
device_name: nspanel
wifi_ssid: "nspanel"
wifi_password: "NSPanel_HA_Blueprint"
nextion_blank_url: "http://homeassistant.local:8123/local/nspanel_blank.tft"
packages:
core_package: !include ../nspanel_esphome.yaml # Core package
@@ -152,12 +153,12 @@ script:
then:
- lambda: |-
ESP_LOGD("script.set_brightness(custom)", "brightness: %i%%", brightness);
uint8_t current_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0));
ESP_LOGV("script.set_brightness(custom)", "current_brightness: %i%%", current_brightness);
if (brightness != current_brightness) {
uint8_t current_light_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0));
ESP_LOGV("script.set_brightness(custom)", "current_light_brightness: %i%%", current_light_brightness);
if (brightness != current_light_brightness) {
if (current_page->state != "screensaver" and brightness > 0) {
auto call = display_light->turn_on();
call.set_brightness(static_cast<float>(id(display_last_brightness)) / 100.0f);
call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);
call.perform();
} else if (display_light->current_values.is_on()) {
auto call = display_light->turn_off();

View File

@@ -67,7 +67,7 @@ We did our best to support your legacy settings and avoid breaking your system,
bluetooth_proxy:
# Set Wi-Fi power save mode to "LIGHT" as required for Bluetooth on ESP32
wifi:
power_save_mode: LIGHT
power_save_mode: LIGHT
##### My customization - End #####
```
@@ -363,6 +363,47 @@ or our [online documentation](https://github.com/Blackymas/NSPanel_HA_Blueprint/
Special thanks to @PaulAntonDeen and @illuzn for their invaluable contributions to these enhancements.
Your feedback and support are crucial to our continuous improvement.
## Patch v4.2.3
This release focuses on targeted bug fixes and enhancements to enhance system stability and functionality.
Major updates include a critical fix for an issue where the panel was getting warmer,
potentially affecting temperature measurements, and resolving a crash issue associated with climate entity rendering.
Additionally, this update introduces new Dutch/Italian date formats for improved localization,
and addresses a minor display issue with the battery indicator on cover pages.
> [!IMPORTANT]
> **Breaking Change**: If you are using the [Customization "Set display as a light"](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#set-display-as-a-light),
> please update the code related to the extension to `script`/`set_brightness` as the global variable `display_last_brightness` was replaced by the new sensor `current_brightness`.
We highly recommend all users update their components to this latest version for an optimized and enhanced user experience.
While this update is compatible with existing v4.2 components, fully updating ensures the best performance and usability.
**Overview of Changes:**
<!-- markdownlint-disable MD013 MD033 -->
| Change | Criticality | Affected Components |
| :-- | :--: | :--: |
| Fix device temperature gap since v4.2 (#1620) | Critical | `Blueprint`<br>`ESPHome`<br>`TFT` |
| Fix crash when rendering a climate entity with no `hvac_action` (#1647) | Critical | `Blueprint` |
| Fix battery indicator not showing on cover pages (#1661) | Minor | `Blueprint` |
| Add Dutch/Italian date format (#1658) | Enhancement | `Blueprint` |
<!-- markdownlint-enable MD013 MD033 -->
**Key Improvements:**
- **Fix for Device Temperature Gap**: Resolved a critical issue with the panel getting warmer on v4.2, potentially affecting its temperature measurements.
- **Fix for Crash When Rendering Climate Entities**: Resolves a critical issue where the blueprint was crashing when trying to render icons for climate entities with no `hvac_action` attributes,
preventing pages from being fully loaded.
- **Fix for Battery Indicator**: Addressed the issue where the battery indicator was not displayed correctly on cover pages. As a bonus, the icon now changes based on the battery level. 😉
- **Add Dutch/Italian Date Format**: Expanding the existing pre-listed date formats, we've added the **Weekday, DD-MM (ex. "Friday, 22-03")** format.
This enhancement caters to our Dutch and Italian users, adding a touch of local flair to their experience.
A special thanks to the community for their support and contributions,
especially to @andythomas for providing useful, informative, and visually appealing temperature trend plots,
and to @shing6326 for their dedicated efforts in resolving the crashes with climate entities.
Your contributions significantly enhance the quality of our project.
For support, feedback, or detailed information about this update,
visit our [GitHub repository](https://github.com/Blackymas/NSPanel_HA_Blueprint)
or our [online documentation](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/README.md).
## What's Next?
Discover what's next and what we are working on right now in our [Milestones](https://github.com/Blackymas/NSPanel_HA_Blueprint/milestones?direction=asc&sort=title&state=open).
@@ -384,9 +425,12 @@ Discover what's next and what we are working on right now in our [Milestones](ht
- Fix for Lights with no brightness supported_features, #1633 - Patch v4.2.2
- Implement dynamic icons and use device_class, #1635 - Patch v4.2.2
- Fixes the incorrect labelling of the entity pages alignment, #1628 - Patch v4.2.2
- @bkbartk - Add Dutch/Italian date format, #1658 - Patch v4.2.3
- @shing6326 - Fix crash on climate page, fix climate icon and color, #1649 - Patch v4.2.3
- And to all users who helped with the tests during development and beta.
## Previous releases
- [v4.2.2 - Bug fixes and minor enhancements](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.2.2)
- [v4.2.1 - Bug fixes](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.2.1)
- [v4.2 - Multi-Alarm Control, Dual Thermostat Functionality, and More](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.2)
- [v4.1.4 - Support to Home Assistant 2023.12.0](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.1.4)

View File

@@ -105,7 +105,7 @@ globals:
restore_value: true
initial_value: '0'
- id: tft_upload_try
- id: tft_upload_attempt
type: uint
restore_value: false
initial_value: '0'
@@ -116,6 +116,17 @@ globals:
initial_value: '"${nextion_update_url}"'
script:
- id: exit_reparse_v414
mode: restart
then:
- logger.log: "Exit reparse"
- uart.write:
id: tf_uart
data: "DRAKJHSUYDGBNCJHGJKSHBDN"
- uart.write:
id: tf_uart
data: [0xFF, 0xFF, 0xFF]
- id: nextion_uart_command
mode: queued
parameters:
@@ -316,6 +327,7 @@ script:
ESP_LOGD(TAG, " Target upload baud rate: %d bps", id(baud_rate_target));
ESP_LOGD(TAG, " Current baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate());
ESP_LOGD(TAG, " Valid TFT: %s", id(tft_is_valid) ? "True" : "False");
// Upload URL
ESP_LOGD(TAG, " Upload URL: %s", url.c_str());
@@ -371,126 +383,58 @@ script:
- lambda: !lambda return (!id(tft_is_valid));
timeout: 1s
### Try twice at the target baud rate
- script.execute: nextion_status
- script.wait: nextion_status
### Attempt twice with upload engine from v4.1.4 (115200bps) when TFT isn't detected
# - if:
# condition:
# - lambda: !lambda return (not id(tft_is_valid));
# then:
# - script.execute:
# id: upload_tft_sequence_attempt_v414
# url: !lambda return url.c_str();
# baud_rate: 115200
# - script.wait: upload_tft_sequence_attempt_v414
### Attempt twice at the target baud rate
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
id: upload_tft_sequence_attempt
baud_rate: !lambda return id(baud_rate_target);
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Try #1
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
# Try #2
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
- script.wait: upload_tft_sequence_attempt
### Try twice at the original baud rate
- script.execute: nextion_status
- script.wait: nextion_status
### Attempt twice at the original baud rate
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
id: upload_tft_sequence_attempt
baud_rate: !lambda return id(baud_rate_original);
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Try #3
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
# Try #4
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
- script.wait: upload_tft_sequence_attempt
### Try twice at the Nextion's default baud rate (115200bps)
- script.execute: nextion_status
- script.wait: nextion_status
### Attempt twice at the Nextion's default baud rate (115200bps)
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
id: upload_tft_sequence_attempt
baud_rate: 115200
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Try #5
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
# Try #6
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
- script.wait: upload_tft_sequence_attempt
### Exit reparse and try twice again
- script.execute: nextion_status
- script.wait: nextion_status
### Attempt twice with upload engine from v4.1.4 (115200bps)
- script.execute:
id: upload_tft_sequence_attempt_v414
url: !lambda return url.c_str();
baud_rate: 115200
- script.wait: upload_tft_sequence_attempt_v414
### Exit reparse and attempt twice again
- script.execute:
id: report_upload_progress
message: "Exiting reparse mode"
- script.wait: report_upload_progress
- script.execute: exit_reparse
- script.wait: exit_reparse
- delay: 5s
- script.execute: nextion_status
- script.wait: nextion_status
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
id: upload_tft_sequence_attempt
baud_rate: 115200
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Try #7
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
# Try #8
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
- script.wait: upload_tft_sequence_attempt
### Then try twice again at 9600bps
- script.execute: nextion_status
- script.wait: nextion_status
### Then attempt twice again at 9600bps
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
id: upload_tft_sequence_attempt
baud_rate: 9600
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Try #9
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
# Try #10
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
- script.wait: upload_tft_sequence_attempt
### Restart Nextion and try twice again at default baud rate (115200bps)
### Restart Nextion and attempt twice again at default baud rate (115200bps)
- script.execute:
id: report_upload_progress
message: "Restarting Nextion display"
@@ -503,26 +447,10 @@ script:
- delay: 2s
- switch.turn_on: screen_power
- delay: 5s
- script.execute: nextion_status
- script.wait: nextion_status
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
id: upload_tft_sequence_attempt
baud_rate: 115200
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Try #11
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
# Try #12
- script.execute: upload_tft_try
- script.wait: upload_tft_try
- delay: 5s
- script.wait: upload_tft_sequence_attempt
### All tries failed ###
- script.execute:
@@ -555,14 +483,726 @@ script:
screen_power->publish_state(true);
ESP_LOGE(TAG, "TFT upload finished unsuccessfully!");
- id: upload_tft_try
- id: upload_tft_sequence_attempt
mode: single
parameters:
baud_rate: uint
then:
- script.execute: nextion_status
- script.wait: nextion_status
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
baud_rate: !lambda return baud_rate;
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# First attempt
- script.execute: upload_tft_attempt
- script.wait: upload_tft_attempt
- delay: 5s
# Backup attempt
- script.execute: upload_tft_attempt
- script.wait: upload_tft_attempt
- delay: 5s
- id: upload_tft_sequence_attempt_v414
mode: single
parameters:
url: string
baud_rate: uint
then:
- script.execute: nextion_status
- script.wait: nextion_status
- script.execute:
id: report_upload_progress
message: "Setting baud rate"
- script.wait: report_upload_progress
- script.execute:
id: set_baud_rate
baud_rate: !lambda return baud_rate;
definitive: false
- script.wait: set_baud_rate
- delay: 2s
# Attempt #7
- script.execute:
id: upload_tft_v414
url: !lambda return url.c_str();
- script.wait: upload_tft_v414
- delay: 5s
# Attempt #8
- script.execute:
id: upload_tft_v414
url: !lambda return url.c_str();
- script.wait: upload_tft_v414
- delay: 5s
- id: upload_tft_v414
mode: single
parameters:
url: string
then:
- lambda: |-
static const char *const TAG = "addon_upload_tft.script.upload_tft_v414";
ESP_LOGD(TAG, "Attempting to upload TFT");
id(tft_upload_attempt)++;
char update_msg[128];
sprintf(update_msg, "Attempt #%d at %" PRIu32 " bps", id(tft_upload_attempt), tf_uart->get_baud_rate());
report_upload_progress->execute(update_msg);
- script.wait: report_upload_progress
- wait_until:
condition:
- lambda: !lambda return (!id(tft_is_valid));
timeout: 1s
- lambda: |-
static const char *const TAG = "addon_upload_tft.script.upload_tft_v414";
ESP_LOGD(TAG, "Starting...");
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++) {
#ifdef ARDUINO
delay(250);
#elif defined(USE_ESP_IDF)
vTaskDelay(pdMS_TO_TICKS(250));
#endif
App.feed_wdt();
}
};
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 = "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};
id(tf_uart).write_array(to_send, sizeof(to_send));
return true;
};
auto recv_ret_string_ = [](std::string &response, uint32_t timeout, bool recv_flag) -> uint16_t
{
static const char *const TAG = "script.upload_tft.recv_ret_string_";
uint16_t ret;
uint8_t c = 0;
uint8_t nr_of_ff_bytes = 0;
uint64_t start;
bool exit_flag = false;
bool ff_flag = false;
start = millis();
while ((timeout == 0 && id(tf_uart).available()) || millis() - start <= timeout)
{
if (!id(tf_uart).available())
{
App.feed_wdt();
continue;
}
id(tf_uart).read_byte(&c);
if (c == 0xFF)
{
nr_of_ff_bytes++;
}
else
{
nr_of_ff_bytes = 0;
ff_flag = false;
}
if (nr_of_ff_bytes >= 3)
ff_flag = true;
response += (char) c;
if (recv_flag)
{
if (response.find(0x05) != std::string::npos)
{
exit_flag = true;
}
}
App.feed_wdt();
delay(2);
if (exit_flag || ff_flag)
{
break;
}
}
if (ff_flag)
response = response.substr(0, response.length() - 3); // Remove last 3 0xFF
ret = response.length();
return ret;
};
auto upload_end_ = [&](bool completed) -> bool
{
static const char *const TAG = "script.upload_tft.upload_end_";
ESP_LOGD(TAG, "Completed: %s", completed ? "True" : "False");
//ESP_LOGD(TAG, "Restarting Nextion");
//send_nextion_command("rest");
#ifdef ARDUINO
delay(1500);
#elif defined(ESP_PLATFORM)
//vTaskDelay(pdMS_TO_TICKS(1500));
#endif
is_updating_ = false;
if (!completed) ESP_LOGD(TAG, "Nextion TFT upload will attempt again");
return completed;
};
#ifdef ARDUINO // arduino # To do: Move to Nextion component on ESPHome
size_t transfer_buffer_size_ = 0;
uint8_t *transfer_buffer_{nullptr};
auto upload_by_chunks_arduino = [&](HTTPClient *http, const std::string &url, int range_start) -> int
{
static const char *const TAG = "script.upload_tft.upload_by_chunks_arduino";
int range_end;
if (range_start == 0 && transfer_buffer_size_ > 16384) { // Start small at the first run in case of a big skip
range_end = 16384 - 1;
} else {
range_end = range_start + transfer_buffer_size_ - 1;
}
if (range_end > tft_size_)
range_end = tft_size_;
char range_header[64];
sprintf(range_header, "bytes=%d-%d", range_start, range_end);
ESP_LOGD(TAG, "Requesting range: %s", range_header);
int tries = 1;
int code;
bool begin_status;
while (tries <= 10) {
begin_status = http->begin(url.c_str());
++tries;
if (!begin_status) {
ESP_LOGD(TAG, "Connection failed");
delay(1000);
continue;
};
http->addHeader("Range", range_header);
code = http->GET();
if (code == 200 || code == 206) {
break;
}
ESP_LOGW(TAG, "HTTP Request failed; URL: %s; Error: %s, retries(%d/10)", url.c_str(),
HTTPClient::errorToString(code).c_str(), tries);
http->end();
delay(1000);
}
if (tries > 10) {
return -1;
}
std::string recv_string;
size_t size;
int fetched = 0;
int range = range_end - range_start;
int write_len;
// fetch next segment from HTTP stream
while (fetched < range) {
size = http->getStreamPtr()->available();
if (!size) {
App.feed_wdt();
delay(2);
continue;
}
int c = http->getStreamPtr()->readBytes(
&transfer_buffer_[fetched], ((size > transfer_buffer_size_) ? transfer_buffer_size_ : size));
fetched += c;
}
http->end();
ESP_LOGD(TAG, "Fetched %d bytes", fetched);
// upload fetched segments to the display in 4KB chunks
for (int i = 0; i < range; i += 4096) {
App.feed_wdt();
write_len = content_length_ < 4096 ? content_length_ : 4096;
id(tf_uart).write_array(&transfer_buffer_[i], write_len);
content_length_ -= write_len;
ESP_LOGD(TAG, "Uploaded %0.1f %%, remaining %d bytes",
100.0 * (tft_size_ - content_length_) / tft_size_,
content_length_);
if (!upload_first_chunk_sent_) {
upload_first_chunk_sent_ = true;
delay(500);
}
recv_ret_string_(recv_string, 5000, true);
if (recv_string[0] != 0x05) { // 0x05 == "ok"
ESP_LOGD(TAG, "recv_string [%s]",
format_hex_pretty(reinterpret_cast<const uint8_t *>(recv_string.data()), recv_string.size()).c_str());
}
// handle partial upload request
if (recv_string[0] == 0x08 && recv_string.size() == 5) {
uint32_t result = 0;
for (int j = 0; j < 4; ++j) {
result += static_cast<uint8_t>(recv_string[j + 1]) << (8 * j);
}
if (result > 0) {
ESP_LOGD(TAG, "Nextion reported new range %d", result);
content_length_ = tft_size_ - result;
return result;
}
}
recv_string.clear();
}
return range_end + 1;
};
auto upload_tft_ = [&](const std::string &url, uint32_t update_baud_rate_) -> bool
{
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: %" PRIu32, update_baud_rate_);
if (is_updating_) {
ESP_LOGD(TAG, "Currently updating");
return upload_end_(false);
}
if (!network::is_connected()) {
ESP_LOGD(TAG, "Network is not connected");
return upload_end_(false);
}
if (!disp1->is_setup()) {
ESP_LOGD(TAG, "Setting Nextion protocol reparse mode to passive");
exit_reparse_v414->execute();
delay_seconds_(5);
}
is_updating_ = true;
HTTPClient http;
http.setTimeout(15000); // Yes 15 seconds.... Helps 8266s along
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
bool begin_status = http.begin(url.c_str());
if (!begin_status) {
is_updating_ = false;
ESP_LOGD(TAG, "Connection failed");
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
allocator.deallocate(transfer_buffer_, transfer_buffer_size_);
return upload_end_(false);
} else {
ESP_LOGD(TAG, "Connected");
}
http.addHeader("Range", "bytes=0-255");
const char *header_names[] = {"Content-Range"};
http.collectHeaders(header_names, 1);
ESP_LOGD(TAG, "Requesting URL: %s", url.c_str());
http.setReuse(true);
// attempt up to 5 times. DNS sometimes needs a second attempt or so
int tries = 1;
int code = http.GET();
delay(100);
while (code != 200 && code != 206 && tries <= 5) {
ESP_LOGW(TAG, "HTTP Request failed; URL: %s; Error: %s, reattempting (%d/5)", url.c_str(),
HTTPClient::errorToString(code).c_str(), tries);
delay(250);
code = http.GET();
++tries;
}
if ((code != 200 && code != 206) || tries > 5) {
return upload_end_(false);
}
String content_range_string = http.header("Content-Range");
content_range_string.remove(0, 12);
content_length_ = content_range_string.toInt();
tft_size_ = content_length_;
http.end();
if (content_length_ < 4096) {
ESP_LOGE(TAG, "Failed to get file size");
return upload_end_(false);
}
ESP_LOGD(TAG, "Updating Nextion");
// The Nextion will ignore the update command if it is sleeping
char command[128];
// 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,%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()) {
id(tf_uart).read_byte(&d);
};
send_nextion_command(command);
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);
}
ESP_LOGD(TAG, "Waiting for upgrade response");
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());
if (response.find(0x05) != std::string::npos) {
ESP_LOGD(TAG, "Preparation for tft update done");
} else {
ESP_LOGD(TAG, "Preparation for tft update failed %d \"%s\"", response[0], response.c_str());
return upload_end_(false);
}
// Nextion wants 4096 bytes at a time. Make chunk_size a multiple of 4096
uint32_t chunk_size = 8192;
if (ESP.getFreeHeap() > 81920) { // Ensure some FreeHeap to other things and limit chunk size
chunk_size = ESP.getFreeHeap() - 65536;
chunk_size = int(chunk_size / 4096) * 4096;
chunk_size = chunk_size > ${upload_tft_chunk_size_max} ? ${upload_tft_chunk_size_max} : chunk_size;
} else if (ESP.getFreeHeap() < 32768) {
chunk_size = 4096;
}
if (transfer_buffer_ == nullptr) {
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
ESP_LOGD(TAG, "Allocating buffer size %d, Heap size is %" PRIu32, chunk_size, ESP.getFreeHeap());
transfer_buffer_ = allocator.allocate(chunk_size);
if (transfer_buffer_ == nullptr) { // Attempt a smaller size
ESP_LOGD(TAG, "Could not allocate buffer size: %d attempting 4096 instead", chunk_size);
chunk_size = 4096;
ESP_LOGD(TAG, "Allocating %d buffer", chunk_size);
transfer_buffer_ = allocator.allocate(chunk_size);
if (!transfer_buffer_)
{
return upload_end_(false);
}
}
transfer_buffer_size_ = chunk_size;
}
ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d using %zu chunksize, Heap Size %" PRIu32,
url.c_str(), content_length_, transfer_buffer_size_, ESP.getFreeHeap());
int result = 0;
while (content_length_ > 0) {
result = upload_by_chunks_arduino(&http, url, result);
if (result < 0) {
ESP_LOGD(TAG, "Error updating Nextion!");
return upload_end_(false);
}
App.feed_wdt();
ESP_LOGD(TAG, "Heap Size %" PRIu32 ", Bytes left %d", ESP.getFreeHeap(), content_length_);
}
is_updating_ = false;
ESP_LOGD(TAG, "Successfully updated Nextion!");
return upload_end_(true);
};
#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 = "addon_upload_tft.script.upload_tft.upload_range_esp_idf_";
ESP_LOGVV(TAG, "url: %s", url.c_str());
uint32_t range_size_ = tft_size_ - range_start;
ESP_LOGVV(TAG, "tft_size_: %i", tft_size_);
ESP_LOGV(TAG, "Available heap: %" PRIu32, esp_get_free_heap_size());
int range_end = (range_start == 0) ? std::min(tft_size_, 16383) : tft_size_;
if (range_size_ <= 0 or range_end <= range_start) {
ESP_LOGE(TAG, "Invalid range");
ESP_LOGD(TAG, "Range start: %i", range_start);
ESP_LOGD(TAG, "Range end: %i", range_end);
ESP_LOGD(TAG, "Range size: %" PRIu32, range_size_);
return -1;
}
esp_http_client_config_t config = {
.url = url.c_str(),
.cert_pem = nullptr,
};
esp_http_client_handle_t client = esp_http_client_init(&config);
char range_header[64];
sprintf(range_header, "bytes=%d-%d", range_start, range_end);
ESP_LOGV(TAG, "Requesting range: %s", range_header);
esp_http_client_set_header(client, "Range", range_header);
ESP_LOGVV(TAG, "Available heap: %u", esp_get_free_heap_size());
ESP_LOGV(TAG, "Opening http connetion");
esp_err_t err;
if ((err = esp_http_client_open(client, 0)) != ESP_OK) {
ESP_LOGE(TAG, "Failed to open HTTP connection: %s", esp_err_to_name(err));
esp_http_client_cleanup(client);
return -1;
}
ESP_LOGV(TAG, "Fetch content length");
int content_length = esp_http_client_fetch_headers(client);
ESP_LOGV(TAG, "content_length = %d", content_length);
if (content_length <= 0) {
ESP_LOGE(TAG, "Failed to get content length: %d", content_length);
esp_http_client_cleanup(client);
return -1;
}
int total_read_len = 0, read_len;
ESP_LOGV(TAG, "Allocate buffer");
uint8_t* buffer = new uint8_t[4096];
std::string recv_string;
if (buffer == nullptr) {
ESP_LOGE(TAG, "Failed to allocate memory for buffer");
ESP_LOGV(TAG, "Available heap: %" PRIu32, esp_get_free_heap_size());
} else {
ESP_LOGV(TAG, "Memory for buffer allocated successfully");
while (true) {
App.feed_wdt();
ESP_LOGVV(TAG, "Available heap: %u", esp_get_free_heap_size());
int read_len = esp_http_client_read(client, reinterpret_cast<char*>(buffer), 4096);
ESP_LOGVV(TAG, "Read %d bytes from HTTP client, writing to UART", read_len);
if (read_len > 0) {
tf_uart->write_array(buffer, read_len);
ESP_LOGVV(TAG, "Write to UART successful");
recv_ret_string_(recv_string, 5000, true);
content_length_ -= read_len;
ESP_LOGD(TAG, "Uploaded %0.2f %%, remaining %d bytes",
100.0 * (tft_size_ - content_length_) / tft_size_,
content_length_);
if (recv_string[0] != 0x05) { // 0x05 == "ok"
ESP_LOGD(TAG, "recv_string [%s]",
format_hex_pretty(reinterpret_cast<const uint8_t *>(recv_string.data()), recv_string.size()).c_str());
}
// handle partial upload request
if (recv_string[0] == 0x08 && recv_string.size() == 5) {
uint32_t result = 0;
for (int j = 0; j < 4; ++j) {
result += static_cast<uint8_t>(recv_string[j + 1]) << (8 * j);
}
if (result > 0) {
ESP_LOGI(TAG, "Nextion reported new range %" PRIu32, result);
content_length_ = tft_size_ - result;
// Deallocate the buffer when done
delete[] buffer;
ESP_LOGVV(TAG, "Memory for buffer deallocated");
esp_http_client_cleanup(client);
esp_http_client_close(client);
return result;
}
}
recv_string.clear();
} else if (read_len == 0) {
ESP_LOGV(TAG, "End of HTTP response reached");
break; // Exit the loop if there is no more data to read
} else {
ESP_LOGE(TAG, "Failed to read from HTTP client, error code: %d", read_len);
break; // Exit the loop on error
}
}
// Deallocate the buffer when done
delete[] buffer;
ESP_LOGVV(TAG, "Memory for buffer deallocated");
}
esp_http_client_cleanup(client);
esp_http_client_close(client);
return range_end + 1;
};
auto upload_tft_ = [&](const std::string &url, unsigned int update_baud_rate_) -> bool {
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: %u", update_baud_rate_);
if (is_updating_) {
ESP_LOGW(TAG, "Currently updating");
return upload_end_(false);
}
if (!network::is_connected()) {
ESP_LOGE(TAG, "Network is not connected");
return upload_end_(false);
}
if (!disp1->is_setup()) {
ESP_LOGD(TAG, "Setting Nextion protocol reparse mode to passive");
exit_reparse_v414->execute();
delay_seconds_(5);
}
is_updating_ = true;
// Define the configuration for the HTTP client
ESP_LOGV(TAG, "Establishing connection to HTTP server");
ESP_LOGVV(TAG, "Available heap: %u", esp_get_free_heap_size());
esp_http_client_config_t config = {
.url = url.c_str(),
.cert_pem = nullptr,
.method = HTTP_METHOD_HEAD,
.timeout_ms = 15000,
};
// Initialize the HTTP client with the configuration
ESP_LOGV(TAG, "Initializing HTTP client");
ESP_LOGV(TAG, "Available heap: %" PRIu32, esp_get_free_heap_size());
esp_http_client_handle_t http = esp_http_client_init(&config);
if (!http) {
ESP_LOGE(TAG, "Failed to initialize HTTP client.");
return upload_end_(false); // return -1 to indicate an error
}
// Perform the HTTP request
ESP_LOGV(TAG, "Check if the client could connect");
ESP_LOGV(TAG, "Available heap: %" PRIu32, esp_get_free_heap_size());
esp_err_t err = esp_http_client_perform(http);
if (err != ESP_OK) {
ESP_LOGE(TAG, "HTTP request failed: %s", esp_err_to_name(err));
esp_http_client_cleanup(http);
return upload_end_(false);
}
// Check the HTTP Status Code
int status_code = esp_http_client_get_status_code(http);
ESP_LOGV(TAG, "HTTP Status Code: %d", status_code);
size_t tft_file_size = esp_http_client_get_content_length(http);
ESP_LOGD(TAG, "TFT file size: %zu", tft_file_size);
if (tft_file_size < 4096) {
ESP_LOGE(TAG, "File size check failed. Size: %zu", tft_file_size);
esp_http_client_cleanup(http);
return upload_end_(false);
} else {
ESP_LOGD(TAG, "File size check passed. Proceeding...");
}
content_length_ = tft_file_size;
tft_size_ = tft_file_size;
ESP_LOGD(TAG, "Updating Nextion");
// The Nextion will ignore the update command if it is sleeping
char command[128];
// 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,%d,1", content_length_, update_baud_rate_);
// Clear serial receive buffer
uint8_t d;
while (id(tf_uart).available()) {
id(tf_uart).read_byte(&d);
};
send_nextion_command(command);
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;
ESP_LOGD(TAG, "Waiting for upgrade response");
recv_ret_string_(response, 2000, 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());
if (response.find(0x05) != std::string::npos) {
ESP_LOGV(TAG, "Preparation for tft update done");
} else {
ESP_LOGE(TAG, "Preparation for tft update failed %d \"%s\"", response[0], response.c_str());
esp_http_client_cleanup(http);
return upload_end_(false);
}
ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d, Heap Size %" PRIu32,
url.c_str(), content_length_, esp_get_free_heap_size());
ESP_LOGV(TAG, "Starting transfer by chunks loop");
int result = 0;
while (content_length_ > 0) {
result = upload_range_esp_idf_(url.c_str(), result);
if (result < 0) {
ESP_LOGE(TAG, "Error updating Nextion!");
esp_http_client_cleanup(http);
return upload_end_(false);
}
App.feed_wdt();
ESP_LOGV(TAG, "Heap Size %" PRIu32 ", Bytes left %d", esp_get_free_heap_size(), content_length_);
}
is_updating_ = false;
ESP_LOGD(TAG, "Successfully updated Nextion!");
ESP_LOGD(TAG, "Close HTTP connection");
esp_http_client_close(http);
esp_http_client_cleanup(http);
return upload_end_(true);
};
#endif
if (upload_tft_(url, 115200)) App.safe_reboot();
char update_msg[128];
sprintf(update_msg, "Attempt #%d at %" PRIu32 " bps failed!", id(tft_upload_attempt), tf_uart->get_baud_rate());
report_upload_progress->execute(update_msg);
ESP_LOGD(TAG, "Finished!");
- script.wait: report_upload_progress
- id: upload_tft_attempt
mode: single
then:
- logger.log: "Trying to upload TFT"
- lambda: !lambda id(tft_upload_try)++;
- logger.log: "Attempting to upload TFT"
- lambda: !lambda id(tft_upload_attempt)++;
- lambda: |-
char update_msg[128];
sprintf(update_msg, "Try #%d at %" PRIu32 " bps", id(tft_upload_try), tf_uart->get_baud_rate());
sprintf(update_msg, "Attempt #%d at %" PRIu32 " bps", id(tft_upload_attempt), tf_uart->get_baud_rate());
report_upload_progress->execute(update_msg);
- script.wait: report_upload_progress
- wait_until:
@@ -573,7 +1213,7 @@ script:
- script.wait: nextion_upload
- lambda: |-
char update_msg[128];
sprintf(update_msg, "Try #%d at %" PRIu32 " bps failed!", id(tft_upload_try), tf_uart->get_baud_rate());
sprintf(update_msg, "Attempt #%d at %" PRIu32 " bps failed!", id(tft_upload_attempt), tf_uart->get_baud_rate());
report_upload_progress->execute(update_msg);
- script.wait: report_upload_progress
@@ -622,5 +1262,12 @@ sensor:
on_value:
then:
lambda: |-
static const char *const TAG = "addon_upload_tft.sensor.display_mode";
id(tft_is_valid) = (display_mode->state > 0 and display_mode->state < 4);
if (id(tft_is_valid))
ESP_LOGD(TAG, "Valid TFT: True");
else {
ESP_LOGW(TAG, "Display mode: %i", int(display_mode->state));
ESP_LOGW(TAG, "Valid TFT: False");
}
...

View File

@@ -17,7 +17,7 @@ substitutions:
name: ${device_name}
wifi_timeout: '15'
##### DON'T CHANGE THIS ######
version: "4.2.2"
version: "4.2.3"
##############################
##### External components #####
@@ -50,7 +50,7 @@ esp32:
##### WIFI SETUP #####
wifi:
id: wifi_component
power_save_mode: NONE
power_save_mode: LIGHT
networks:
- id: wifi_default
ssid: ${wifi_ssid}
@@ -109,8 +109,7 @@ time:
- seconds: 0
then:
- script.execute: refresh_datetime
- minutes: /5
seconds: 30
- seconds: 30
then:
- script.execute: watchdog
@@ -821,13 +820,6 @@ globals:
restore_value: true
initial_value: '10'
##### Remember last brighness value sent to Nextion #####
- id: display_last_brightness
type: uint
restore_value: false
initial_value: '100'
##### Temperature unit #####
##### Is embedded sensor used for indoor temperature? #####
- id: embedded_indoor_temp
type: bool
@@ -1115,6 +1107,7 @@ number:
if (current_page->state != "screensaver")
{
disp1->set_backlight_brightness(x/100);
current_brightness->update();
timer_dim->execute(current_page->state.c_str(), int(timeout_dim->state));
timer_sleep->execute(current_page->state.c_str(), int(timeout_sleep->state));
if (current_page->state == "settings") disp1->set_component_text_printf("bright_text", "%i%%", int(x));
@@ -1138,7 +1131,7 @@ number:
id(display_dim_brightness_global) = int(x);
disp1->send_command_printf("brightness_dim=%i", int(x));
disp1->send_command_printf("settings.dimslider.val=%i", int(x));
if (current_page->state != "screensaver" and (id(display_last_brightness) <= id(display_dim_brightness_global)))
if (current_page->state != "screensaver" and (current_brightness->state <= id(display_dim_brightness_global)))
{
set_brightness->execute(x);
timer_sleep->execute(current_page->state.c_str(), int(timeout_sleep->state));
@@ -1309,6 +1302,7 @@ sensor:
platform: ntc
sensor: resistance_sensor
unit_of_measurement: ${temp_units}
internal: false
calibration:
b_constant: 3950
reference_temperature: 25°C
@@ -1353,11 +1347,31 @@ sensor:
- lambda: |-
timer_reset_all->execute("settings");
###### Display Brightness - Current value (%) #####
- id: current_brightness
name: ${name} Display Current brightness
platform: nextion
variable_name: dim
precision: 0
accuracy_decimals: 0
unit_of_measurement: "%"
icon: mdi:brightness-percent
#update_interval: 60s
internal: false
disabled_by_default: true
on_value:
then:
- lambda: |-
static const char *const TAG = "sensor.current_brightness";
ESP_LOGD(TAG, "Current brightness: %i%%", int(x));
###### Page Id - Current #####
- id: page_id
name: ${name} Page Id
platform: nextion
variable_name: dp
precision: 0
accuracy_decimals: 0
internal: true
entity_category: diagnostic
on_value:
@@ -1380,6 +1394,7 @@ sensor:
platform: nextion
variable_name: display_mode
precision: 0
accuracy_decimals: 0
internal: true
entity_category: diagnostic
@@ -1389,6 +1404,7 @@ sensor:
platform: nextion
variable_name: charset
precision: 0
accuracy_decimals: 0
internal: true
entity_category: diagnostic
@@ -2224,8 +2240,14 @@ script:
static const char *const TAG = "script.page_screensaver";
ESP_LOGV(TAG, "Updating screensaver page");
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();
if (id(screensaver_display_time)) {
disp1->show_component("text");
set_component_color->execute("screensaver.text",id(screensaver_display_time_color));
refresh_datetime->execute();
} else {
disp1->set_backlight_brightness(0.0f);
}
current_brightness->update();
}
- id: page_settings
@@ -2484,7 +2506,9 @@ script:
disp1->send_command_printf("wakeup_timer.en=1");
else
disp1->set_backlight_brightness(static_cast<float>(brightness) / 100.0f);
id(display_last_brightness) = brightness;
current_brightness->update();
- delay: 5s
- lambda: current_brightness->update();
- id: set_climate
mode: restart
@@ -2779,6 +2803,7 @@ script:
- lambda: |-
static const char *const TAG = "script.setup_sequence";
ESP_LOGE(TAG, "A non-compatible TFT is installed");
ESP_LOGE(TAG, "Display mode: %f", display_mode->state);
- lambda: |-
static const char *const TAG = "script.setup_sequence";
ESP_LOGD(TAG, "Nextion setup sequence finished!");
@@ -2902,7 +2927,7 @@ script:
then:
- lambda: |-
ESP_LOGV("script.timer_dim", "Reset timer: %is", timeout);
if (id(display_last_brightness) <= id(display_dim_brightness_global)
if (current_brightness->state <= id(display_dim_brightness_global)
and page != "screensaver"
and page != "boot"
and page != "blank-screensaver") {

Binary file not shown.

Binary file not shown.

View File

@@ -17,7 +17,6 @@ Page alarm
page home
}else
{
sendme
vis bt_home,0
vis bt_away,0
vis bt_night,0
@@ -25,6 +24,9 @@ Page alarm
vis bt_bypass,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 3

View File

@@ -12,15 +12,13 @@ Page boot
Events
Preinitialize Event
sendme
dim=100
vis bt_reboot,0
sendme
dim=100
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
baud_rate.txt+=" bps"
Postinitialize Event
sendme
Page Exit Event
dim=0
@@ -104,7 +102,7 @@ Text tft_version
Dragging : 0
Send Component ID : on press and release
Associated Keyboard: none
Text : 4.2.2
Text : 4.2.3
Max. Text Size : 9
Text esph_version
@@ -157,6 +155,13 @@ Dual-state Button bt_reboot
Text : Reboot
Max. Text Size : 6
Events
Touch Release Event
if(api==0)
{
rest
}
Timer tm_esphome
Attributes
ID : 13

View File

@@ -17,12 +17,14 @@ Page buttonpage01
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage02
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage03
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage04
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -14,7 +14,6 @@ Page climate
Preinitialize Event
if(api==1||embedded.val==1)
{
sendme
vis target_icon,0
vis target_high,0
vis target_low,0
@@ -34,6 +33,9 @@ Page climate
page home
}
Postinitialize Event
sendme
Page Exit Event
covx embedded.val,va2.txt,0,0
if(timer0.en==1)
@@ -652,6 +654,7 @@ Hotspot decrease_temp
va0.val=temp_number0.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==1)
{
@@ -665,6 +668,7 @@ Hotspot decrease_temp
va0.val=temp_number1.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==2)
{
@@ -678,6 +682,7 @@ Hotspot decrease_temp
va0.val=temp_number2.val%10
covx va0.val,va1.txt,0,0
target_low.txt+="."+va1.txt
target_low.txt+=temp_unit.txt
}
}
@@ -714,6 +719,7 @@ Hotspot increase_temp
va0.val=temp_number0.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==1)
{
@@ -727,6 +733,7 @@ Hotspot increase_temp
va0.val=temp_number1.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==2)
{
@@ -740,6 +747,7 @@ Hotspot increase_temp
va0.val=temp_number2.val%10
covx va0.val,va1.txt,0,0
target_low.txt+="."+va1.txt
target_low.txt+=temp_unit.txt
}
}

View File

@@ -15,11 +15,11 @@ Page confirm
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (int32) page_id
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page cover
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) va1
Attributes
ID : 7

View File

@@ -15,11 +15,11 @@ Page entitypage01
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage02
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage03
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage04
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page fan
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) fansetting
Attributes
ID : 7

View File

@@ -12,7 +12,6 @@ Page home
Events
Preinitialize Event
sendme
back_page_id=0
vis bt_notific,is_notification
vis bt_qrcode,is_qrcode
@@ -23,6 +22,9 @@ Page home
vis right_bt_text,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 33

View File

@@ -15,11 +15,11 @@ Page keyb_num
if(api==0)
{
page page_id.val
}else
{
sendme
}
Postinitialize Event
sendme
Variable (int32) page_id
Attributes
ID : 17

View File

@@ -17,7 +17,6 @@ Page light
page home
}else
{
sendme
vis light_b_press,1
vis lightslider,1
vis light_value,1
@@ -38,6 +37,9 @@ Page light
vis color_button,0
}
Postinitialize Event
sendme
Variable (int32) rgb565
Attributes
ID : 22

View File

@@ -15,11 +15,11 @@ Page media_player
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 18

View File

@@ -15,11 +15,11 @@ Page notification
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 5

View File

@@ -11,7 +11,7 @@ Page qrcode
Swide right page ID: disabled
Events
Preinitialize Event
Postinitialize Event
sendme
Text qrcode_label

View File

@@ -3,7 +3,7 @@ Page screensaver
ID : 0
Scope : local
Dragging : 0
Send Component ID : disabled
Send Component ID : on press and release
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
@@ -12,9 +12,12 @@ Page screensaver
Events
Preinitialize Event
sendme
vis text,0
dim=brightness_sleep
Postinitialize Event
sendme
Touch Release Event
page back_page_id
@@ -29,7 +32,7 @@ Text text
Max. Text Size : 1000
Events
Touch Press Event
Touch Release Event
page back_page_id
Timer swipestore

View File

@@ -12,7 +12,6 @@ Page settings
Events
Preinitialize Event
sendme
covx brightslider.val,bright_text.txt,0,0
bright_text.txt+="%"
covx dimslider.val,dim_text.txt,0,0
@@ -20,6 +19,9 @@ Page settings
vis lbl_sleep,0
vis bt_sleep,0
Postinitialize Event
sendme
Text bright_text
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page weather01
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather02
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather03
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather04
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather05
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

Binary file not shown.

Binary file not shown.

View File

@@ -17,7 +17,6 @@ Page alarm
page home
}else
{
sendme
vis bt_home,0
vis bt_away,0
vis bt_night,0
@@ -25,6 +24,9 @@ Page alarm
vis bt_bypass,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 3

View File

@@ -12,12 +12,13 @@ Page boot
Events
Preinitialize Event
sendme
dim=100
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
baud_rate.txt+=" bps"
Postinitialize Event
sendme
Page Exit Event
dim=0
@@ -101,9 +102,16 @@ Text tft_version
Dragging : 0
Send Component ID : on press and release
Associated Keyboard: none
Text : 4.2.2
Text : 4.2.3
Max. Text Size : 9
Events
Touch Release Event
if(api==0)
{
rest
}
Text esph_version
Attributes
ID : 9
@@ -154,6 +162,13 @@ Dual-state Button bt_reboot
Text : Reboot
Max. Text Size : 6
Events
Touch Release Event
if(api==0)
{
rest
}
Timer tm_esphome
Attributes
ID : 13

View File

@@ -17,12 +17,14 @@ Page buttonpage01
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage02
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage03
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage04
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -14,7 +14,6 @@ Page climate
Preinitialize Event
if(api==1||embedded.val==1)
{
sendme
vis target_icon,0
vis target_high,0
vis target_low,0
@@ -34,6 +33,9 @@ Page climate
page home
}
Postinitialize Event
sendme
Page Exit Event
covx embedded.val,va2.txt,0,0
if(timer0.en==1)
@@ -652,6 +654,7 @@ Hotspot decrease_temp
va0.val=temp_number0.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==1)
{
@@ -665,6 +668,7 @@ Hotspot decrease_temp
va0.val=temp_number1.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==2)
{
@@ -678,6 +682,7 @@ Hotspot decrease_temp
va0.val=temp_number2.val%10
covx va0.val,va1.txt,0,0
target_low.txt+="."+va1.txt
target_low.txt+=temp_unit.txt
}
}
@@ -714,6 +719,7 @@ Hotspot increase_temp
va0.val=temp_number0.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==1)
{
@@ -727,6 +733,7 @@ Hotspot increase_temp
va0.val=temp_number1.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==2)
{
@@ -740,6 +747,7 @@ Hotspot increase_temp
va0.val=temp_number2.val%10
covx va0.val,va1.txt,0,0
target_low.txt+="."+va1.txt
target_low.txt+=temp_unit.txt
}
}

View File

@@ -15,11 +15,11 @@ Page confirm
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (int32) page_id
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page cover
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) va1
Attributes
ID : 7

View File

@@ -15,11 +15,11 @@ Page entitypage01
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage02
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage03
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage04
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page fan
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) fansetting
Attributes
ID : 7

View File

@@ -12,7 +12,6 @@ Page home
Events
Preinitialize Event
sendme
back_page_id=0
vis bt_notific,is_notification
vis bt_qrcode,is_qrcode
@@ -23,6 +22,9 @@ Page home
vis right_bt_text,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 33

View File

@@ -15,11 +15,11 @@ Page keyb_num
if(api==0)
{
page page_id.val
}else
{
sendme
}
Postinitialize Event
sendme
Variable (int32) page_id
Attributes
ID : 17

View File

@@ -17,7 +17,6 @@ Page light
page home
}else
{
sendme
vis light_b_press,1
vis lightslider,1
vis light_value,1
@@ -38,6 +37,9 @@ Page light
vis color_button,0
}
Postinitialize Event
sendme
Variable (int32) rgb565
Attributes
ID : 22

View File

@@ -15,11 +15,11 @@ Page media_player
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 18

View File

@@ -15,11 +15,11 @@ Page notification
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 5

View File

@@ -11,7 +11,7 @@ Page qrcode
Swide right page ID: disabled
Events
Preinitialize Event
Postinitialize Event
sendme
Text qrcode_label

View File

@@ -3,7 +3,7 @@ Page screensaver
ID : 0
Scope : local
Dragging : 0
Send Component ID : disabled
Send Component ID : on press and release
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
@@ -12,9 +12,12 @@ Page screensaver
Events
Preinitialize Event
sendme
vis text,0
dim=brightness_sleep
Postinitialize Event
sendme
Touch Release Event
page back_page_id
@@ -29,7 +32,7 @@ Text text
Max. Text Size : 1000
Events
Touch Press Event
Touch Release Event
page back_page_id
Timer swipestore

View File

@@ -12,7 +12,6 @@ Page settings
Events
Preinitialize Event
sendme
covx brightslider.val,bright_text.txt,0,0
bright_text.txt+="%"
covx dimslider.val,dim_text.txt,0,0
@@ -20,6 +19,9 @@ Page settings
vis lbl_sleep,0
vis bt_sleep,0
Postinitialize Event
sendme
Text bright_text
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page weather01
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather02
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather03
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather04
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather05
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

Binary file not shown.

Binary file not shown.

View File

@@ -17,7 +17,6 @@ Page alarm
page home
}else
{
sendme
vis bt_home,0
vis bt_away,0
vis bt_night,0
@@ -25,6 +24,9 @@ Page alarm
vis bt_bypass,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 3

View File

@@ -12,15 +12,13 @@ Page boot
Events
Preinitialize Event
sendme
dim=100
vis bt_reboot,0
sendme
dim=100
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
baud_rate.txt+=" bps"
Postinitialize Event
sendme
Page Exit Event
dim=0
@@ -104,7 +102,7 @@ Text tft_version
Dragging : 0
Send Component ID : on press and release
Associated Keyboard: none
Text : 4.2.2
Text : 4.2.3
Max. Text Size : 9
Text esph_version
@@ -157,6 +155,13 @@ Dual-state Button bt_reboot
Text : Reboot
Max. Text Size : 6
Events
Touch Release Event
if(api==0)
{
rest
}
Timer tm_esphome
Attributes
ID : 13

View File

@@ -17,12 +17,14 @@ Page buttonpage01
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage02
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage03
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -17,12 +17,14 @@ Page buttonpage04
page home
}else
{
sendme
vis 255,0
vis button_back,1
vis page_index,1
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 4

View File

@@ -14,7 +14,6 @@ Page climate
Preinitialize Event
if(api==1||embedded.val==1)
{
sendme
vis target_icon,0
vis target_high,0
vis target_low,0
@@ -34,6 +33,9 @@ Page climate
page home
}
Postinitialize Event
sendme
Page Exit Event
covx embedded.val,va2.txt,0,0
if(timer0.en==1)
@@ -652,6 +654,7 @@ Hotspot decrease_temp
va0.val=temp_number0.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==1)
{
@@ -665,6 +668,7 @@ Hotspot decrease_temp
va0.val=temp_number1.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==2)
{
@@ -678,6 +682,7 @@ Hotspot decrease_temp
va0.val=temp_number2.val%10
covx va0.val,va1.txt,0,0
target_low.txt+="."+va1.txt
target_low.txt+=temp_unit.txt
}
}
@@ -714,6 +719,7 @@ Hotspot increase_temp
va0.val=temp_number0.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==1)
{
@@ -727,6 +733,7 @@ Hotspot increase_temp
va0.val=temp_number1.val%10
covx va0.val,va1.txt,0,0
target_high.txt+="."+va1.txt
target_high.txt+=temp_unit.txt
}
}else if(active_slider.val==2)
{
@@ -740,6 +747,7 @@ Hotspot increase_temp
va0.val=temp_number2.val%10
covx va0.val,va1.txt,0,0
target_low.txt+="."+va1.txt
target_low.txt+=temp_unit.txt
}
}

View File

@@ -15,11 +15,11 @@ Page confirm
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (int32) page_id
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page cover
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) va1
Attributes
ID : 7

View File

@@ -15,11 +15,11 @@ Page entitypage01
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage02
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage03
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page entitypage04
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text value01_label
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page fan
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) fansetting
Attributes
ID : 7

View File

@@ -12,7 +12,6 @@ Page home
Events
Preinitialize Event
sendme
back_page_id=0
vis bt_notific,is_notification
vis bt_qrcode,is_qrcode
@@ -23,6 +22,9 @@ Page home
vis right_bt_text,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 33

View File

@@ -15,11 +15,11 @@ Page keyb_num
if(api==0)
{
page page_id.val
}else
{
sendme
}
Postinitialize Event
sendme
Variable (int32) page_id
Attributes
ID : 17

View File

@@ -17,7 +17,6 @@ Page light
page home
}else
{
sendme
vis light_b_press,1
vis lightslider,1
vis light_value,1
@@ -38,6 +37,9 @@ Page light
vis color_button,0
}
Postinitialize Event
sendme
Variable (int32) rgb565
Attributes
ID : 22

View File

@@ -15,11 +15,11 @@ Page media_player
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 18

View File

@@ -15,11 +15,11 @@ Page notification
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 5

View File

@@ -11,7 +11,7 @@ Page qrcode
Swide right page ID: disabled
Events
Preinitialize Event
Postinitialize Event
sendme
Text qrcode_label

View File

@@ -3,7 +3,7 @@ Page screensaver
ID : 0
Scope : local
Dragging : 0
Send Component ID : disabled
Send Component ID : on press and release
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
@@ -12,9 +12,12 @@ Page screensaver
Events
Preinitialize Event
sendme
vis text,0
dim=brightness_sleep
Postinitialize Event
sendme
Touch Release Event
page back_page_id
@@ -29,7 +32,7 @@ Text text
Max. Text Size : 1000
Events
Touch Press Event
Touch Release Event
page back_page_id
Timer swipestore

View File

@@ -12,7 +12,6 @@ Page settings
Events
Preinitialize Event
sendme
covx brightslider.val,bright_text.txt,0,0
bright_text.txt+="%"
covx dimslider.val,dim_text.txt,0,0
@@ -20,6 +19,9 @@ Page settings
vis lbl_sleep,0
vis bt_sleep,0
Postinitialize Event
sendme
Text bright_text
Attributes
ID : 3

View File

@@ -15,11 +15,11 @@ Page weather01
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather02
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather03
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather04
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

View File

@@ -15,11 +15,11 @@ Page weather05
if(api==0)
{
page home
}else
{
sendme
}
Postinitialize Event
sendme
Text day
Attributes
ID : 4

Binary file not shown.

View File

@@ -17,7 +17,6 @@ Page alarm
page home
}else
{
sendme
vis bt_home,0
vis bt_away,0
vis bt_night,0
@@ -25,6 +24,9 @@ Page alarm
vis bt_bypass,0
}
Postinitialize Event
sendme
Variable (string) lastclick
Attributes
ID : 3

View File

@@ -12,15 +12,13 @@ Page boot
Events
Preinitialize Event
sendme
dim=100
vis bt_reboot,0
sendme
dim=100
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
baud_rate.txt+=" bps"
Postinitialize Event
sendme
Page Exit Event
dim=0
@@ -104,7 +102,7 @@ Text tft_version
Dragging : 0
Send Component ID : on press and release
Associated Keyboard: none
Text : 4.2.2
Text : 4.2.3
Max. Text Size : 9
Text esph_version
@@ -157,6 +155,13 @@ Dual-state Button bt_reboot
Text : Reboot
Max. Text Size : 6
Events
Touch Release Event
if(api==0)
{
rest
}
Timer tm_esphome
Attributes
ID : 13

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