diff --git a/ReleaseNotes.md b/ReleaseNotes.md index a4a09bd..0309196 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,106 +1,92 @@ # v4.3 - TItle to be defined -## Support this project -**As always, we would like to thank everyone who donated to this project and remind you that every donation helps to support this project -So if you haven't made a donation yet, now would be a good time ;)** - -[![Paypal](https://user-images.githubusercontent.com/41958506/212499642-b2fd097a-0938-4bfc-b37b-74df64592c58.png)](https://www.paypal.com/donate/?hosted_button_id=S974SWQMB8PB2) - ## General -MUST BE UPDATED. +*To be updated.* -Hello everyone! Our latest update introduces a range of enhancements designed to elevate your experience with the firmware. -This update is focused on improving user interaction, featuring a more intuitive TFT upload process and expanded customization options. -Key enhancements include upgraded functionality for Alarm Control Panels & Thermostats and new personalization features on the Home page. +Hello everyone! We're excited to introduce enhancements in this update, focusing on improving user interaction and expanding customization options. This release features an intuitive TFT upload process, enhanced Alarm Control Panels & Thermostats functionality, and new personalization options. -We're enthusiastic about our ongoing work to [make the NSPanel firmware more user-friendly and accessible](https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/1602). -This release marks significant progress in this direction, with improvements such as the -streamlined TFT upload process and initial steps towards adopting `esp-idf` as the default framework. -Additionally, our documentation has been revamped for greater clarity and user-friendliness. -Expect more user-centric updates coming your way soon! +We're committed to making NSPanel firmware more user-friendly. This release marks significant progress, including a streamlined TFT upload process and steps towards adopting `esp-idf` as the default framework. Our documentation has been revamped for clarity and ease of use. Stay tuned for more updates! -Dive into the details below to see how these changes can enhance your daily use of NSPanel. -We value your feedback and are eager to hear your thoughts! +[Learn more about our efforts](https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/1602). -### Upcoming Change: Switching to ESP-IDF Framework by March 2024 -We have some important updates for our community – by March 2024, we're moving to the **ESP-IDF** as our standard framework. -This shift aims to significantly boost the memory capacity on the ESP, allowing for the addition of new features and broader customizations. +## ESP-IDF Framework Transition +With this release, we've officially transitioned to the **ESP-IDF** framework. This move is part of our ongoing efforts to enhance the memory capacity and expand the features available on the ESP, facilitating broader customization and new functionalities. -There's ample time before this transition takes place, so no need to hurry. -When it's time to switch, flashing your device using a serial cable will be necessary, similar to the initial custom firmware setup. +For users updating to this version: +- **Flashing Required**: To adopt the ESP-IDF framework, flashing your device using a serial cable is necessary. This step mirrors the initial custom firmware setup process. +- **Arduino Framework Still Available**: For those who prefer the `arduino` framework or require Over-The-Air (OTA) updates, it remains an option. Detailed guidance on how to choose your framework is provided in our [customization documentation](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md). -For those who might need a serial firmware installation before March, -trying out `esp-idf` earlier could be a beneficial move towards adapting to future developments. - -If you're unable to switch by March or if serial flashing isn't an option for you, -the `arduino` framework will still be available for Over-The-Air (OTA) updates. - -For detailed guidance on framework customization, check out our [customization documentation](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md). -We're dedicated to facilitating a smooth transition and are here to assist with any queries or concerns. +This transition is a significant milestone for us, promising a robust platform for our community. We're here to help with any questions or assistance needed during this change. For more details and support, visit our [community discussion](https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/1756). ## Updating -Updates may come with changes on the blueprint inputs and 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. +Please review your settings post-update to ensure compatibility. Refer to the update procedures [here](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/howto.md#update-blueprint). -### Files that need to be reloaded -1. nspanel_eu.tft, nspanel_us.tft or nspanel_us_land.tft - v4.3 -2. nspanel_esphome.yaml - v4.3 -3. nspanel_blueprint.yaml - v4.3 +## Breaking Changes and Guidance +With this release, we're implementing several important changes. While we strive to improve the panel, we understand that changes can affect your setups. +Here's a detailed overview and guidance for a smooth transition: -### Instructions - *You can find the update procedures following here:* +1. **Transition to ESP-IDF Framework**: This release marks the official switch to the ESP-IDF framework, enhancing performance and allowing for more complex features. + - **What to Do**: You'll need to flash your device with the new firmware using a serial connection. + Detailed instructions are available in our [flashing guide](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/flashing.md). + - **Support for Arduino Framework**: If you're not ready to make the switch or prefer the Arduino framework, it's still supported for OTA updates. + See our [framework customization documentation](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#framework) for details on how to select your preferred framework. -- [How To - All important thing you should know - Update](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/howto.md#update-blueprint) +2. **Several Services Changed**: In our pursuit to enhance integration capabilities and future-proof our services, we've undertaken a comprehensive restructuring of our API. +This change is aimed at improving functionality and compatibility but may require adjustments to your current automations. + - **What to Do**: We strongly encourage you to review our updated [API documentation](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/api.md). + This resource has been meticulously updated to assist you in updating your automation scripts accordingly. + Pay special attention to the examples section, which offers valuable insights and practical guidance for adapting your existing setups seamlessly. -## Breaking changes -1. **Default framework changed to `esp-idf`**. Please follow instructions bellow for more details on how to proceed. -2. **All services have changed**. If you are using the services directly in your automations, please look at our [API documentation](docs/api.md). +3. **15s Hardware Button Press No Longer Restarts the Device**: This feature was removed to repurpose the hardware button for more versatile uses. + - **What to Do**: If you relied on this feature, see our [customization guide](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#restart-with-15s-button-press) for alternatives. + Additionally, the reset pin remains an option for manual resets. - We understand this change can require substantial work on the exisiting automations with direct calls to the panel's services, - however this will significantly improve the future customizations by providing compreensive documentation, standardizing and optimizing services calls. -3. **`captive_portal` and `web_server` are back to basic package**. If you want to remove those to free-up memory, -please look at "[Customizations - Remove non-essential components](docs/customization.md#remove-non-essential-components)". -4. **15s hardware button press no longer restarts the device** as the benefits of this were too small compared to leaving the button available for other uses. -If you still want the 15s restart behaviour, you can look at "[Customizations - Restart with 15s button press](docs/customization.md#restart-with-15s-button-press) and, -in addition to that, the [reset pin in the bottom of your panel](docs/pics/eu_reset_button.png) can be used. -5. **Relay Fallback Switches Removed**: These switches have been deprecated and hidden for some time and are now fully removed from the code. -If you have used any customizations to expose these switches, please refer to the updated guide in "[Customizations - Expose Relay Fallback Switch](docs/customization.md#expose-relay-fallback-switch)", -or you can use a call to the service `esphome.xxxxx_init_relays` to set it accordingly without the additional memory consumption related to creating additional switches. +4. **Relay Fallback Switches Removed**: These switches were deprecated and have now been removed to streamline the firmware and reduce memory usage. + - **What to Do**: For users who utilized customizations to expose these switches, refer to our updated customization guide. + Alternatively, use the `esphome.xxxxx_init_hardware` service for a similar functionality without the memory overhead. + +We appreciate your understanding and patience during this transition. +Our goal is to ensure NSPanel continues to evolve in a way that enhances your experience and meets future needs. +Our community and support channels are open for any questions or assistance you may require. ## Overview of noteworthy changes 1. Transition to ESP-IDF as Default Framework 2. Performance improvements 3. New API documentation 4. Selectable font size for screensaver time display +5. Hardware buttons bars visible on all pages ## Details of noteworthy changes - ### 1. Transition to ESP-IDF as Default Framework -As previously announced, we have now transitioned to ESP-IDF as our default framework starting with this release. -This change aligns with our commitment to provide a robust and future-ready platform, offering enhanced performance, direct hardware access, and access to the latest developments from Espressif. +We've transitioned to ESP-IDF, enhancing our platform's performance and capabilities. +This change promises new possibilities for your projects. +Those continuing with the Arduino framework can find instructions for setting framework preferences. -For those who have prepared for this transition, we look forward to the new possibilities this brings to your projects. - -For users wishing to continue with the Arduino framework, instructions have been provided on explicitly setting your framework preference. -We are here to assist through our community support channels for any questions or assistance needed. - -For the ones previously using the default framework (without any explicity framework especification on your panel's yaml), remember you have to flash your device using a serial cable this time, -otherwise you can face some issues. - -More information about this transition can be found in our discussion here: https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/1756 +For more information, visit our [discussion](https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/1756). ### 2. Performance improvements -Some text +*Details to be added.* + +### 3. New API documentation +*Details to be added.* + +### 4. Selectable font size for screensaver time display +*Details to be added.* + +### 5. The hardware buttons bars visible in all pages +Bars indicating statuses of entities controlled by hardware buttons are now visible on all pages, including screensaver. +Color customization for these bars is also available. ## Support -For support, feedback, or detailed information about this update, +For support or more 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). +Discover our upcoming projects in our [Milestones](https://github.com/Blackymas/NSPanel_HA_Blueprint/milestones?direction=asc&sort=title&state=open). -## Special thanks to +## Special Thanks +*Details to be added.* ## Previous releases - [v4.2.4 - Critical bug fixes](https://github.com/Blackymas/NSPanel_HA_Blueprint/releases/tag/v4.2.4) diff --git a/components/nspanel_ha_blueprint/ha_components.h b/components/nspanel_ha_blueprint/ha_components.h index 9003205..6966870 100644 --- a/components/nspanel_ha_blueprint/ha_components.h +++ b/components/nspanel_ha_blueprint/ha_components.h @@ -18,17 +18,17 @@ namespace nspanel_ha_blueprint { * @return A HomeAssistantEntity struct containing the extracted domain and the unique ID. */ HomeAssistantEntity extractHomeAssistantEntity(const std::string& entity_id) { - size_t dotPos = input.find("."); + size_t dotPos = entity_id.find("."); HomeAssistantEntity result; if (dotPos != std::string::npos) { - // Extract domain and id from the input string - result.domain = input.substr(0, dotPos); - result.id = input.substr(dotPos + 1); + // Extract domain and id from the entity_id string + result.domain = entity_id.substr(0, dotPos); + result.id = entity_id.substr(dotPos + 1); } else { - // No dot found, the entire input is considered as id. + // No dot found, the entire entity_id is considered as id. result.domain = "invalid"; - result.id = input; + result.id = entity_id; } return result; } diff --git a/components/nspanel_ha_blueprint/hardware.h b/components/nspanel_ha_blueprint/hardware.h index 1689d07..1544455 100644 --- a/components/nspanel_ha_blueprint/hardware.h +++ b/components/nspanel_ha_blueprint/hardware.h @@ -61,7 +61,8 @@ namespace nspanel_ha_blueprint { // Bits 6 and 7 are reserved for future expansion. }; - void update_bitwise_setting(uint8_t& settings, bool condition, RelaySettings flag) { + template + void update_bitwise_setting(uint8_t& settings, bool condition, SettingsEnum flag) { if (condition) { settings |= flag; // Set bit } else { diff --git a/esphome/nspanel_esphome_addon_upload_tft.yaml b/esphome/nspanel_esphome_addon_upload_tft.yaml index 638de29..840b47f 100644 --- a/esphome/nspanel_esphome_addon_upload_tft.yaml +++ b/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -105,6 +105,16 @@ globals: nspanel_ha_blueprint_upload_tft: script: + - id: nextion_status + mode: restart + then: + - lambda: |- + static const char *const TAG = "script.nextion_status"; + ESP_LOGD(TAG, "Nextion status:"); + ESP_LOGD(TAG, " Is detected: %s", YESNO(disp1->is_detected())); + ESP_LOGD(TAG, " Is setup: %s", YESNO(disp1->is_setup())); + ESP_LOGD(TAG, " Queue size: %d", disp1->queue_size()); + - id: nextion_upload mode: single parameters: @@ -166,6 +176,11 @@ script: App.feed_wdt(); } + - id: !extend stop_all + then: + - lambda: |- + nextion_status->stop(); + - id: upload_tft mode: single parameters: diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index ae53e87..0986cc2 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -24,8 +24,8 @@ substitutions: ##### External components ##### external_components: - source: - #type: local - #path: packages/Blackymas/components + # type: local + # path: packages/Blackymas/components type: git url: https://github.com/Blackymas/NSPanel_HA_Blueprint ref: dev # To do: Change it for releasing @@ -157,7 +157,6 @@ time: - seconds: 0 then: - script.execute: refresh_datetime - - seconds: 30 on_time_sync: then: @@ -370,9 +369,25 @@ api: disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color)); } - // Refresh display + // Refresh relays display refresh_relays->execute(); + // Buttons bars settings + update_bitwise_setting(id(buttons_settings), button_left, ButtonSettings::ButtonLeft_Enabled); + update_bitwise_setting(id(buttons_settings), button_right, ButtonSettings::ButtonRight_Enabled); + + if (button_bar_color_on.size() == 3) + id(buttons_color_on) = ColorUtil::color_to_565(esphome::Color(button_bar_color_on[0], + button_bar_color_on[1], + button_bar_color_on[2])); + if (button_bar_color_off.size() == 3) + id(buttons_color_off) = ColorUtil::color_to_565(esphome::Color(button_bar_color_off[0], + button_bar_color_off[1], + button_bar_color_off[2])); + + // Refresh buttons bars display + refresh_hardware_buttons_bars->execute(); + // Embedded thermostat id(is_embedded_thermostat) = embedded_climate; @@ -404,26 +419,7 @@ api: then: - lambda: |- if (not id(is_uploading_tft)) { - static const char *const TAG = "service.page_home"; - ESP_LOGV(TAG, "date_color: %i", date_color.size()); - ESP_LOGV(TAG, "time_format: %s", time_format.c_str()); - ESP_LOGV(TAG, "time_color: %i", time_color.size()); - ESP_LOGV(TAG, "meridiem: %i", meridiem.size()); - ESP_LOGV(TAG, "chip_font: %" PRIi32, chip_font); - ESP_LOGV(TAG, "custom_buttons_font: %" PRIi32, custom_buttons_font); - ESP_LOGV(TAG, "notification_icon: %s", notification_icon.c_str()); - ESP_LOGV(TAG, "notification_icon_color_normal: %i", notification_icon_color_normal.size()); - ESP_LOGV(TAG, "notification_icon_color_unread: %i", notification_icon_color_unread.size()); - ESP_LOGV(TAG, "qrcode: %s", YESNO(qrcode)); - ESP_LOGV(TAG, "qrcode_icon: %s", qrcode_icon.c_str()); - ESP_LOGV(TAG, "qrcode_icon_color: %i", qrcode_icon_color.size()); - ESP_LOGV(TAG, "entities_pages: %s", YESNO(entities_pages)); - ESP_LOGV(TAG, "entities_pages_icon: %s", entities_pages_icon.c_str()); - ESP_LOGV(TAG, "entities_pages_icon_color: %i", entities_pages_icon_color.size()); - ESP_LOGV(TAG, "outdoor_temp_font: %i", outdoor_temp_font); - // Localization - ESP_LOGV(TAG, "Load localization"); id(mui_time_format) = time_format; if (meridiem.size() == 2) { id(mui_meridiem)[0] = meridiem[0]; @@ -431,14 +427,12 @@ api: } // Date/Time colors - ESP_LOGV(TAG, "Load date/time colors"); id(home_date_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(date_color[0], date_color[1], date_color[2])); id(home_time_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(time_color[0], time_color[1], time_color[2])); disp1->set_component_font_color("home.date", id(home_date_color)); disp1->set_component_font_color("home.time", id(home_time_color)); // Chips icon size - ESP_LOGV(TAG, "Chips size"); disp1->send_command_printf("home.chip_relay1.font=%" PRIi32, chip_font); disp1->send_command_printf("home.chip_relay2.font=%" PRIi32, chip_font); disp1->send_command_printf("home.chip_climate.font=%" PRIi32, chip_font); @@ -449,7 +443,6 @@ api: id(home_chip_font_id) = chip_font; // Custom buttons icon size - ESP_LOGV(TAG, "Custom buttons sizes"); id(home_custom_buttons_font_id) = custom_buttons_font; for (int i = 1; i <= 7; ++i) { disp1->send_command_printf("home.button%02d.font=%" PRIu8, i, id(home_custom_buttons_font_id)); @@ -459,11 +452,9 @@ api: disp1->send_command_printf("home.bt_entities.font=%" PRIu8, id(home_custom_buttons_font_id)); // Outdoor temperature font size - ESP_LOGV(TAG, "Outdoor temperature font size"); disp1->send_command_printf("home.outdoor_temp.font==%" PRIi32, outdoor_temp_font); // Notification button - ESP_LOGV(TAG, "Set Notification button"); disp1->send_command_printf("is_notification=%i", (notification_text->state.empty() and notification_label->state.empty()) ? 0 : 1); disp1->set_component_text_printf("home.bt_notific", "%s", notification_icon.c_str()); id(home_notify_icon_color_normal) = esphome::display::ColorUtil::color_to_565(esphome::Color(notification_icon_color_normal[0], @@ -475,13 +466,11 @@ api: disp1->set_component_font_color("home.bt_notific", notification_unread->state ? id(home_notify_icon_color_unread) : id(home_notify_icon_color_normal)); // QRCode button - ESP_LOGV(TAG, "Set QRCode button"); disp1->send_command_printf("is_qrcode=%i", qrcode ? 1 : 0); disp1->set_component_text_printf("home.bt_qrcode", "%s", qrcode_icon.c_str()); disp1->set_component_font_color("home.bt_qrcode", esphome::display::ColorUtil::color_to_565(esphome::Color(qrcode_icon_color[0], qrcode_icon_color[1], qrcode_icon_color[2]))); // Entities pages button - ESP_LOGV(TAG, "Set Entities button"); disp1->send_command_printf("is_entities=%i", entities_pages ? 1 : 0); disp1->set_component_text_printf("home.bt_entities", "%s", entities_pages_icon.c_str()); disp1->set_component_font_color("home.bt_entities", esphome::display::ColorUtil::color_to_565(esphome::Color(entities_pages_icon_color[0], @@ -843,14 +832,7 @@ display: - script.execute: setup_sequence on_page: lambda: |- - static const char *const TAG = "display.disp1.on_page"; - if (id(is_uploading_tft)) { - ESP_LOGD(TAG, "Page changed ignored as a TFT upload is in progress"); - } else if (x > page_names.size()) { - ESP_LOGW(TAG, "Invalid page index: %i", int(x)); - } else { - ESP_LOGD(TAG, "Nextion page changed"); - ESP_LOGD(TAG, "New page: %s (%i)" , page_names[x], x); + if (not id(is_uploading_tft)) { page_id->update(); if (current_page->state != page_names[x] or x == 9) { current_page->publish_state(page_names[x]); @@ -859,11 +841,6 @@ display: } on_touch: lambda: |- - static const char *const TAG = "display.disp1.on_touch"; - ESP_LOGV(TAG, "Nextion touch event detected!"); - ESP_LOGV(TAG, "Page: %s", page_names[page_id]); - ESP_LOGV(TAG, "Component Id: %i", component_id); - ESP_LOGV(TAG, "Event type: %s", touch_event ? "Press" : "Release"); timer_reset_all->execute(page_names[page_id]); ##### START - GLOBALS CONFIGURATION ##### @@ -1373,8 +1350,6 @@ select: icon: mdi:page-next-outline on_value: - lambda: |- - static const char *const TAG = "select.wakeup_page_name"; - ESP_LOGD(TAG, "New wake-up page selected: %s", x.c_str()); page_screensaver->execute(); ##### START - SENSOR CONFIGURATION ##### @@ -1404,8 +1379,6 @@ sensor: on_value: then: - lambda: |- - static const char *const TAG = "sensor.blueprint_status"; - ESP_LOGD(TAG, "Blueprint progress: %i%%", int(round(x))); // Update api value on Nextion disp1->send_command_printf("api=%i", (x > 99) ? 1 : 0); @@ -1481,11 +1454,6 @@ sensor: icon: mdi:brightness-percent internal: false disabled_by_default: false - 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 @@ -1499,13 +1467,7 @@ sensor: on_value: then: - lambda: |- - static const char *const TAG = "sensor.page_id"; - ESP_LOGD(TAG, "New page Id: %i", int(x)); - if (id(is_uploading_tft)) { - ESP_LOGD(TAG, "Skipping actions as a TFT upload is in progress"); - } else if (x > page_names.size()) { - ESP_LOGW(TAG, "Invalid page index: %i", int(x)); - } else if (current_page->state != page_names[x]) { + if (not id(is_uploading_tft) and current_page->state != page_names[x]) { current_page->publish_state(page_names[x]); page_changed->execute(page_names[x]); } @@ -1670,8 +1632,6 @@ text_sensor: on_value: then: - lambda: |- - static const char *const TAG = "text_sensor.disp1_nspanel_event"; - ESP_LOGW(TAG, "Starting"); DynamicJsonDocument doc(1024); deserializeJson(doc, x); std::string page = doc["page"]; @@ -1679,10 +1639,6 @@ text_sensor: if (not (component == "currentpage" and (page == "screensaver" or page == "home"))) timer_reset_all->execute(page.c_str()); std::string value = doc["value"]; std::string entity = detailed_entity->state.c_str(); // doc["entity"]; - ESP_LOGW(TAG, "page: %s", page.c_str()); - ESP_LOGW(TAG, "component: %s", component.c_str()); - ESP_LOGW(TAG, "value: %s", value.c_str()); - ESP_LOGW(TAG, "entity: %s", entity.c_str()); auto ha_event = new esphome::api::CustomAPIDevice(); ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", { @@ -1708,7 +1664,6 @@ text_sensor: on_value: then: - lambda: |- - static const char *const TAG = "text_sensor.localevent"; DynamicJsonDocument doc(1024); deserializeJson(doc, x); std::string page = doc["page"]; @@ -1795,8 +1750,6 @@ text_sensor: update_interval: never on_value: - lambda: |- - static const char *const TAG = "text_sensor.version_tft"; - ESP_LOGD(TAG, "TFT version: %s", x.c_str()); if (current_page->state == "boot") { page_boot->execute(); timer_reset_all->execute("boot"); @@ -1831,23 +1784,25 @@ script: return (compare_versions("${version}", version_tft->state.c_str()) and compare_versions("${version}", id(version_blueprint))); timeout: 60s - lambda: |- - if (id(is_uploading_tft)) check_versions->stop(); - static const char *const TAG = "script.check_versions"; - ESP_LOGD(TAG, "Versions:"); - ESP_LOGD(TAG, " ESPHome: ${version}"); - ESP_LOGD(TAG, " TFT: %s", version_tft->state.c_str()); - if (not compare_versions("${version}", version_tft->state.c_str())) ESP_LOGE(TAG, "TFT version mismatch!"); - ESP_LOGD(TAG, " Blueprint: %s", id(version_blueprint)); - if (not compare_versions("${version}", id(version_blueprint))) ESP_LOGE(TAG, "Blueprint version mismatch!"); + if (not id(is_uploading_tft)) { + ESP_LOGD("script.check_versions", "Versions:"); + ESP_LOGD("script.check_versions", " ESPHome: ${version}"); + ESP_LOGD("script.check_versions", " TFT: %s", version_tft->state.c_str()); + if (not compare_versions("${version}", version_tft->state.c_str())) + ESP_LOGE("script.check_versions", "TFT version mismatch!"); + ESP_LOGD("script.check_versions", " Blueprint: %s", id(version_blueprint)); + if (not compare_versions("${version}", id(version_blueprint))) + ESP_LOGE("script.check_versions", "Blueprint version mismatch!"); - auto ha_event = new esphome::api::CustomAPIDevice(); - ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", - { - {"type", "version"}, - {"tft", version_tft->state.c_str()}, - {"esphome", "${version}"}, - {"blueprint", id(version_blueprint)} - }); + auto ha_event = new esphome::api::CustomAPIDevice(); + ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", + { + {"type", "version"}, + {"tft", version_tft->state.c_str()}, + {"esphome", "${version}"}, + {"blueprint", id(version_blueprint)} + }); + } - id: display_embedded_temp mode: restart @@ -1909,9 +1864,7 @@ script: then: - lambda: |- if (id(is_uploading_tft)) global_settings->stop(); - static const char *const TAG = "script.global_settings"; // Blueprint version - ESP_LOGV(TAG, "Check Blueprint version"); nspanel_ha_blueprint::copyStringToCharArray(id(version_blueprint), blueprint_version); disp1->set_component_text_printf("boot.bluep_version", "%s", blueprint_version.c_str()); if (current_page->state == "boot") page_boot->execute(); @@ -1922,7 +1875,6 @@ script: id(mui_unavailable_global) = mui_unavailable; // Screen saver page (sleep) - ESP_LOGV(TAG, "Setup screensaver page"); id(screensaver_display_time) = screensaver_time; id(screensaver_display_time_font) = screensaver_time_font; id(screensaver_display_time_color) = esphome::display::ColorUtil::color_to_565(esphome::Color(screensaver_time_color[0], screensaver_time_color[1], screensaver_time_color[2])); @@ -1933,10 +1885,8 @@ script: if (current_page->state != "boot") { // Update current page - ESP_LOGV(TAG, "Update current page"); page_changed->execute(current_page->state.c_str()); } - ESP_LOGV(TAG, "Current page: %s", current_page->state.c_str()); disp1->set_component_text_printf("boot.bluep_version", "%s", blueprint_version.c_str()); - if: @@ -2013,16 +1963,8 @@ script: entity: string then: - lambda: |- - if (id(is_uploading_tft)) ha_call_service->stop(); - static const char *const TAG = "script.ha_call_service"; - ESP_LOGV(TAG, "Calling Home Assisant service"); - ESP_LOGV(TAG, " Type: service_call"); - ESP_LOGV(TAG, " Service: %s", service.c_str()); - ESP_LOGV(TAG, " Entity: %s", entity.c_str()); - ESP_LOGV(TAG, " Key: %s", key.c_str()); - ESP_LOGV(TAG, " Value: %s", value.c_str()); - if (service != "" and not service.empty()) - { + if (not id(is_uploading_tft)) { + if (service != "" and not service.empty()) { auto ha_event = new esphome::api::CustomAPIDevice(); ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", { @@ -2033,17 +1975,7 @@ script: {"value", value} }); } - ESP_LOGV(TAG, "Finished"); - - - id: nextion_status - mode: restart - then: - - lambda: |- - static const char *const TAG = "script.nextion_status"; - ESP_LOGD(TAG, "Nextion status:"); - ESP_LOGD(TAG, " Is detected: %s", YESNO(disp1->is_detected())); - ESP_LOGD(TAG, " Is setup: %s", YESNO(disp1->is_setup())); - ESP_LOGD(TAG, " Queue size: %d", disp1->queue_size()); + } - id: notification_clear mode: restart @@ -2065,8 +1997,7 @@ script: mode: restart then: - lambda: |- - static const char *const TAG = "script.page_blank"; - ESP_LOGV(TAG, "Construct blank page"); + ESP_LOGV("script.page_blank", "Construct blank page"); disp1->set_component_text_printf("esp_version", "ESP: ${version}"); // ESPHome version #ifdef ARDUINO disp1->set_component_text_printf("framework", "Arduino"); @@ -2079,8 +2010,6 @@ script: mode: restart then: - lambda: |- - static const char *const TAG = "script.page_boot"; - ESP_LOGV(TAG, "Construct boot page"); set_brightness->execute(100); disp1->set_component_text_printf("boot.esph_version", "${version}"); // ESPHome version if (current_page->state == "boot") { @@ -2128,8 +2057,6 @@ script: page: string then: - lambda: |- - static const char *const TAG = "script.page_changed"; - // Go to boot page if not initiated if (not nextion_init->state) goto_page->execute("boot"); // Reset globals @@ -2151,14 +2078,17 @@ script: } // Report new page to logs - ESP_LOGD(TAG, "New page: %s", page.c_str()); - if (!detailed_entity->state.empty()) ESP_LOGD(TAG, "Entity shown: %s", detailed_entity->state.c_str()); + ESP_LOGD("script.page_changed", "New page: %s", page.c_str()); + if (!detailed_entity->state.empty()) + ESP_LOGD("script.page_changed", "Entity shown: %s", detailed_entity->state.c_str()); + + // Update buttons bars on screen + refresh_hardware_buttons_bars->execute(); // Reset timers timer_reset_all->execute(page.c_str()); // Report new page to Home Assistant - ESP_LOGV(TAG, "Trigger HA event"); auto ha_event = new esphome::api::CustomAPIDevice(); ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", { @@ -2278,8 +2208,6 @@ script: mode: restart then: - lambda: |- - static const char *const TAG = "script.page_notification"; - ESP_LOGV(TAG, "Updating notification page"); disp1->set_component_text_printf("notification.notifi_label", "%s", notification_label->state.c_str()); display_wrapped_text->execute("notification.notifi_text01", notification_text->state.c_str(), display_mode->state == 2 ? 23 : 32); @@ -2292,8 +2220,6 @@ script: then: - lambda: |- if (current_page->state == "screensaver" and not id(is_uploading_tft)) { - static const char *const TAG = "script.page_screensaver"; - ESP_LOGV(TAG, "Updating screensaver page"); disp1->send_command_printf("back_page_id=%" PRIu8, get_page_id(wakeup_page_name->state.c_str())); if (id(screensaver_display_time)) { disp1->send_command_printf("screensaver.text.font=%i", id(screensaver_display_time_font)); @@ -2310,8 +2236,6 @@ script: mode: restart then: - lambda: |- - static const char *const TAG = "script.page_settings"; - ESP_LOGV(TAG, "Construct settings page"); //disp1->set_component_text_printf("bt_sleep", "%s", (id(sleep_mode).state) ? "\uEA19" : "\uEA18"); //mdi:toggle-switch-outline or mdi:toggle-switch-off-outline set_component_visibility->execute("page_settings.lbl_sleep", false); set_component_visibility->execute("page_settings.bt_sleep", false); @@ -2356,8 +2280,6 @@ script: mode: restart then: - lambda: |- - static const char *const TAG = "script.refresh_datetime"; - ESP_LOGV(TAG, "Updating time display"); std::string time_format_str = id(mui_time_format); if (time_format_str.find("%-H") != std::string::npos) { time_format_str = time_format_str.replace(time_format_str.find("%-H"), sizeof("%-H")-1, @@ -2376,40 +2298,51 @@ script: } std::string meridiem_text = (id(time_provider).now().hour<12) ? id(mui_meridiem)[0] : id(mui_meridiem)[1]; if (current_page->state == "screensaver" and id(screensaver_display_time)) { - ESP_LOGV(TAG, "Updating time on screensaver page"); std::string time_format_str_sleep = time_format_str; if (time_format_str_sleep.find("%p") != std::string::npos) time_format_str_sleep.replace(time_format_str_sleep.find("%p"), sizeof("%p")-1, meridiem_text.c_str()); disp1->set_component_text_printf("text", "%s", id(time_provider).now().strftime(time_format_str_sleep).c_str()); } - ESP_LOGV(TAG, "Updating home page meridiem"); disp1->set_component_text_printf("home.meridiem", "%s", (time_format_str.find("%p") != std::string::npos) ? meridiem_text.c_str() : " "); - ESP_LOGV(TAG, "Updating home page time"); disp1->set_component_text_printf("home.time", "%s", id(time_provider).now().strftime(time_format_str).c_str()); + refresh_hardware_buttons_bars->execute(); - id: refresh_hardware_buttons_bars mode: restart then: - lambda: |- if (not id(is_uploading_tft)) { - if (display_mode->state == 3) { // US Landscape model - if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button - disp1->fill_area(467, 174, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(468, 173, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); - } - if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button - disp1->fill_area(467, 28, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(468, 27, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); - } - } else { // US Portrait and EU models - if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button - disp1->fill_area(48, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(47, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); - } - if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button - disp1->fill_area(289, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); - disp1->fill_area(288, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); - } + switch (int(display_mode->state)) { + case 1: // EU model + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button + disp1->fill_area(48, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(47, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + } + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button + disp1->fill_area(289, 307, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(288, 308, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + } + break; + case 2: // US Portrait + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button + disp1->fill_area(17, 466, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(16, 467, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + } + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button + disp1->fill_area(184, 466, 118, 3, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(183, 467, 120, 1, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + } + break; + case 3: // US Landscape + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_Enabled) { // Left button + disp1->fill_area(467, 174, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(468, 173, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonLeft_State) ? id(buttons_color_on) : id(buttons_color_off)); + } + if (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_Enabled) { // Right button + disp1->fill_area(467, 28, 3, 118, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + disp1->fill_area(468, 27, 1, 120, (id(buttons_settings) & nspanel_ha_blueprint::ButtonSettings::ButtonRight_State) ? id(buttons_color_on) : id(buttons_color_off)); + } + break; } } @@ -2420,9 +2353,7 @@ script: condition: - lambda: !lambda return id(setup_sequence_completed); - lambda: |- - static const char *const TAG = "script.refresh_notification"; bool is_notification = ((not notification_text->state.empty()) or (not notification_label->state.empty())); - ESP_LOGV(TAG, "Notification: %s", YESNO(is_notification)); disp1->send_command_printf("is_notification=%i", is_notification ? 1 : 0); set_component_visibility->execute("home.bt_notific", is_notification); - wait_until: @@ -2512,28 +2443,25 @@ script: - lambda: !lambda return (tf_uart->get_baud_rate() != baud_rate); then: - lambda: |- - static const char *const TAG = "script.set_baud_rate"; - ESP_LOGD(TAG, "Baud rate changing from %" PRIu32 " to %" PRIu32 " bps", tf_uart->get_baud_rate(), baud_rate); - ESP_LOGD(TAG, "Flush UART"); + ESP_LOGD("script.set_baud_rate", "Baud rate changing from %" PRIu32 " to %" PRIu32 " bps", tf_uart->get_baud_rate(), baud_rate); + ESP_LOGD("script.set_baud_rate", "Flush UART"); - wait_until: condition: - lambda: !lambda return (tf_uart->available() < 1); timeout: 5s - lambda: |- - static const char *const TAG = "script.set_baud_rate"; - ESP_LOGD(TAG, "Sending instruction '%s=%" PRIu32 "' to Nextion", definitive ? "bauds" : "baud", baud_rate); + ESP_LOGD("script.set_baud_rate", "Sending instruction '%s=%" PRIu32 "' to Nextion", definitive ? "bauds" : "baud", baud_rate); disp1->send_command_printf("%s=%" PRIu32, definitive ? "bauds" : "baud", baud_rate); - ESP_LOGD(TAG, "Flush UART"); + ESP_LOGD("script.set_baud_rate", "Flush UART"); - wait_until: condition: - lambda: !lambda return (tf_uart->available() < 1); timeout: 5s - lambda: |- - static const char *const TAG = "script.set_baud_rate"; - ESP_LOGD(TAG, "Set ESPHome new baud rate to %" PRIu32 " bps", baud_rate); + ESP_LOGD("script.set_baud_rate", "Set ESPHome new baud rate to %" PRIu32 " bps", baud_rate); tf_uart->set_baud_rate(baud_rate); tf_uart->load_settings(); - ESP_LOGD(TAG, "Current baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate()); + ESP_LOGD("script.set_baud_rate", "Current baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate()); - id: set_brightness mode: restart @@ -2541,8 +2469,6 @@ script: brightness: float then: - lambda: |- - static const char *const TAG = "script.set_brightness"; - ESP_LOGD(TAG, "brightness: %.0f%%", brightness); if (brightness == display_brightness->state and current_page->state != "boot" and current_page->state != "screensaver") disp1->send_command_printf("wakeup_timer.en=1"); else @@ -2567,20 +2493,7 @@ script: then: - lambda: |- if (id(is_uploading_tft)) set_climate->stop(); - static const char *const TAG = "script.set_climate"; - ESP_LOGD(TAG, "Starting"); - ESP_LOGD(TAG, " current_temp: %f", current_temp); - ESP_LOGD(TAG, " supported_features: %i", supported_features); - ESP_LOGD(TAG, " target_temp: %f", target_temp); - ESP_LOGD(TAG, " target_temp_high: %f", target_temp_high); - ESP_LOGD(TAG, " target_temp_low: %f", target_temp_low); - ESP_LOGD(TAG, " temp_step: %d", temp_step); - ESP_LOGD(TAG, " total_steps: %d", total_steps); - ESP_LOGD(TAG, " temp_offset: %i", temp_offset); - ESP_LOGD(TAG, " climate_icon: %s", climate_icon.c_str()); - ESP_LOGD(TAG, " embedded_climate: %s", YESNO(embedded_climate)); if (current_page->state == "climate") { - ESP_LOGD(TAG, "Page climate is visible"); disp1->send_command_printf("climateslider.maxval=%i", total_steps); disp1->send_command_printf("slider_high.maxval=%i", total_steps); disp1->send_command_printf("slider_low.maxval=%i", total_steps); @@ -2636,7 +2549,6 @@ script: } disp1->set_component_value("embedded", (embedded_climate) ? 1 : 0); } - ESP_LOGD(TAG, "Finished"); - id: set_component_visibility mode: queued @@ -2657,26 +2569,17 @@ script: mode: restart then: - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Starting Nextion setup sequence"); - ESP_LOGD(TAG, "Fetching Page Id"); page_id->update(); - wait_until: condition: - lambda: !lambda return (not isnan(page_id->state)); timeout: 15s - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Fetching charset"); - display_charset->update(); + - lambda: display_charset->update(); - wait_until: condition: - lambda: !lambda return (not isnan(display_charset->state)); timeout: 5s - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Fetching display mode"); - display_mode->update(); + - lambda: display_mode->update(); - wait_until: condition: - lambda: !lambda return (not isnan(display_mode->state)); @@ -2686,18 +2589,12 @@ script: - lambda: !lambda return (not isnan(display_mode->state)); then: # Project's TFT detected - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Goto page Boot"); goto_page->execute("boot"); - ESP_LOGD(TAG, "Fetching TFT version"); version_tft->update(); - wait_until: condition: - lambda: !lambda return (not version_tft->state.empty()); timeout: 5s - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Wait for Wi-Fi"); - wait_until: condition: - lambda: !lambda return (wifi_component->is_connected()); @@ -2707,13 +2604,10 @@ script: - lambda: !lambda return (wifi_component->is_connected()); then: # Wi-Fi connected - lambda: |- - static const char *const TAG = "script.setup_sequence"; if (current_page->state == "boot") { - ESP_LOGD(TAG, "Publish IP address on screen"); disp1->set_component_text_printf("boot.ip_addr", "%s", network::get_ip_address().str().c_str()); set_brightness->execute(100); } - ESP_LOGD(TAG, "Wait for API"); - wait_until: condition: - lambda: !lambda return (api_server->is_connected()); @@ -2723,41 +2617,23 @@ script: - lambda: !lambda return (api_server->is_connected()); then: # API connected - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Publish IP address on screen"); - ESP_LOGD(TAG, "Report setup to Home Assistant"); auto ha_event = new esphome::api::CustomAPIDevice(); ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", { {"type", "boot"}, {"step", "start"} }); - else: # API not connected - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGE(TAG, "API not available"); - else: # Wi-Fi not connected - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGE(TAG, "Wi-Fi not available"); - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGE(TAG, "Wi-Fi not available"); - wait_until: condition: - lambda: !lambda return id(setup_sequence_completed); timeout: 1s - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGD(TAG, "Set dimming values"); set_brightness->execute(display_brightness->state); - ESP_LOGD(TAG, "Set page Settings"); disp1->send_command_printf("brightness=%i", int(display_brightness->state)); disp1->send_command_printf("settings.brightslider.val=%i", int(display_brightness->state)); disp1->send_command_printf("brightness_dim=%i", int(display_dim_brightness->state)); disp1->send_command_printf("settings.dimslider.val=%i", int(display_dim_brightness->state)); disp1->send_command_printf("brightness_sleep=%i", int(display_sleep_brightness->state)); - ESP_LOGD(TAG, "Report to Home Assistant"); nextion_init->publish_state(disp1->is_setup()); if (api_server->is_connected() and disp1->is_setup()) { auto ha_event = new esphome::api::CustomAPIDevice(); @@ -2768,12 +2644,10 @@ script: }); } // Chips icon size - ESP_LOGV(TAG, "Adjusting icon's sizes"); for (int i = 1; i <= 7; ++i) { disp1->send_command_printf("home.chip%02d.font=%i", i, id(home_chip_font_id)); } // Custom buttons icon size - ESP_LOGV(TAG, "Adjusting custom buttons sizes"); for (int i = 1; i <= 7; ++i) { disp1->send_command_printf("home.button%02d.font=%i", i, id(home_custom_buttons_font_id)); } @@ -2781,13 +2655,11 @@ script: disp1->send_command_printf("home.bt_qrcode.font=%i", id(home_custom_buttons_font_id)); disp1->send_command_printf("home.bt_entities.font=%i", id(home_custom_buttons_font_id)); disp1->send_command_printf("home.wifi_icon.font=%i", id(home_chip_font_id)); - ESP_LOGV(TAG, "Restoring relay's icon colors"); disp1->set_component_font_color("home.chip_relay1", id(home_relay1_icon_color)); disp1->set_component_font_color("home.chip_relay2", id(home_relay2_icon_color)); timer_reset_all->execute("boot"); notification_clear->execute(); id(setup_sequence_completed) = true; - ESP_LOGD(TAG, "Wait for leaving boot page"); - wait_until: condition: - not: @@ -2797,21 +2669,12 @@ script: timeout: 10s - lambda: |- if (current_page->state == "boot") goto_page->execute(wakeup_page_name->state.c_str()); - else: # Unknown TFT - - lambda: |- - static const char *const TAG = "script.setup_sequence"; - ESP_LOGE(TAG, "No compatible TFT detected"); - 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!"); + - logger.log: "Nextion setup sequence finished!" - id: stop_all mode: restart then: - lambda: |- - static const char *const TAG = "script.stop_all"; - ESP_LOGD(TAG, "Stopping scripts..."); change_climate_state->stop(); check_versions->stop(); display_embedded_temp->stop(); @@ -2819,7 +2682,6 @@ script: global_settings->stop(); ha_button->stop(); ha_call_service->stop(); - nextion_status->stop(); notification_clear->stop(); page_alarm->stop(); page_blank->stop(); @@ -2867,7 +2729,6 @@ script: timer_sleep->stop(); update_alarm_icon->stop(); update_climate_icon->stop(); - ESP_LOGD(TAG, "Finished"); ###### Timers ###### - id: timer_reset_all # Global timer reset - Triggered with a touch on the screen diff --git a/hmi/dev/create_us_land_and_CJK_hmi_from_original.md b/hmi/dev/create_us_land_and_CJK_hmi_from_original.md index 4ca357b..1070c7f 100644 --- a/hmi/dev/create_us_land_and_CJK_hmi_from_original.md +++ b/hmi/dev/create_us_land_and_CJK_hmi_from_original.md @@ -5,11 +5,6 @@ - **Program.s:** - Change to `display_mode=3` -- **Page `home`:** - 1. Change left_bt_pic (x,y,w,h) from ( 47,307,120,3) to (467,173,3,120) - 2. Change right_bt_pic(x,y,w,h) from (288,307,120,3) to (467, 27,3,120) - 3. Rotate pictures 30 & 31 by 90degrees - You will find the rotated pics under `\dev\ui\us_land\pics` folder. - ## Creating `nspanel_CJK_xxx.HMI` from `nspanel_xxx.HMI` - **Program.s:** diff --git a/hmi/dev/nspanel_CJK_eu_code/Program.s.txt b/hmi/dev/nspanel_CJK_eu_code/Program.s.txt index 0558b85..bdaf5e7 100644 --- a/hmi/dev/nspanel_CJK_eu_code/Program.s.txt +++ b/hmi/dev/nspanel_CJK_eu_code/Program.s.txt @@ -10,7 +10,7 @@ Program.s int is_entities=0,is_qrcode=0,is_notification=0 int brightness=100,brightness_dim=40,brightness_sleep=0 int display_mode=1 // 1 = EU, 2 = US, 3 = US landscape, 4 = blank - int charset=2 // 1 = International (original), 2 = CJK + int charset=1 // 1 = International (original), 2 = CJK //bauds=115200//Configure baudrate recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port diff --git a/hmi/dev/nspanel_CJK_eu_code/home.txt b/hmi/dev/nspanel_CJK_eu_code/home.txt index e450593..43044a3 100644 --- a/hmi/dev/nspanel_CJK_eu_code/home.txt +++ b/hmi/dev/nspanel_CJK_eu_code/home.txt @@ -35,7 +35,7 @@ Variable (string) lastclick Variable (string) click_comp Attributes - ID : 41 + ID : 39 Scope : local Text : Max. Text Size: 8 @@ -414,7 +414,7 @@ Text meridiem Text button01 Attributes - ID : 38 + ID : 36 Scope : global Dragging : 0 Send Component ID : on press and release @@ -442,7 +442,7 @@ Text button01 Text button02 Attributes - ID : 39 + ID : 37 Scope : global Dragging : 0 Send Component ID : on press and release @@ -470,7 +470,7 @@ Text button02 Text button03 Attributes - ID : 40 + ID : 38 Scope : global Dragging : 0 Send Component ID : on press and release @@ -498,7 +498,7 @@ Text button03 Text button04 Attributes - ID : 43 + ID : 41 Scope : global Dragging : 0 Send Component ID : on press and release @@ -526,7 +526,7 @@ Text button04 Text button05 Attributes - ID : 44 + ID : 42 Scope : global Dragging : 0 Send Component ID : on press and release @@ -554,7 +554,7 @@ Text button05 Text button06 Attributes - ID : 45 + ID : 43 Scope : global Dragging : 0 Send Component ID : on press and release @@ -582,7 +582,7 @@ Text button06 Text unavailable Attributes - ID : 46 + ID : 44 Scope : local Dragging : 0 Send Component ID : disabled @@ -604,26 +604,6 @@ Picture weather page weather01 } -Dual-state Button left_bt_pic - Attributes - ID : 35 - Scope : global - Dragging : 0 - Send Component ID: on press and release - State : unpressed - Text : - Max. Text Size : 0 - -Dual-state Button right_bt_pic - Attributes - ID : 36 - Scope : global - Dragging : 0 - Send Component ID: on press and release - State : unpressed - Text : - Max. Text Size : 0 - Timer swipestore Attributes ID : 2 @@ -649,7 +629,7 @@ Timer settings_timer Timer wakeup_timer Attributes - ID : 37 + ID : 35 Scope : local Period (ms): 50 Enabled : yes @@ -672,7 +652,7 @@ Timer wakeup_timer Timer click_timer Attributes - ID : 42 + ID : 40 Scope : local Period (ms): 800 Enabled : no diff --git a/hmi/dev/nspanel_CJK_eu_code/utilities.txt b/hmi/dev/nspanel_CJK_eu_code/utilities.txt new file mode 100644 index 0000000..cf4600e --- /dev/null +++ b/hmi/dev/nspanel_CJK_eu_code/utilities.txt @@ -0,0 +1,430 @@ +Page utilities + Attributes + ID : 0 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Locked : no + Swide up page ID : disabled + Swide down page ID : disabled + Swide left page ID : disabled + Swide right page ID: disabled + + Events + Preinitialize Event + if(api==0) + { + page home + } + vis unavailable,0 + + Postinitialize Event + sendme + +Text title + Attributes + ID : 1 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Associated Keyboard: none + Text : Power Dashboard + Max. Text Size : 100 + +Text title_icon + Attributes + ID : 2 + Scope : local + Dragging : 0 + Send Component ID : on press and release + Associated Keyboard: none + Text :  + Max. Text Size : 10 + +Text unavailable + Attributes + ID : 5 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : + Max. Text Size : 1 + +Text t0 + Attributes + ID : 6 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : î´½ + Max. Text Size : 4 + +Text t1 + Attributes + ID : 7 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 賈 + Max. Text Size : 4 + +Text t2 + Attributes + ID : 9 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text :  + Max. Text Size : 4 + +Text t3 + Attributes + ID : 10 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text :  + Max. Text Size : 4 + +Text t4 + Attributes + ID : 11 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Green + Max. Text Size : 10 + +Text t5 + Attributes + ID : 12 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Fossil + Max. Text Size : 10 + +Text t6 + Attributes + ID : 15 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Home + Max. Text Size : 10 + +Text t7 + Attributes + ID : 16 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 全 + Max. Text Size : 4 + +Text t8 + Attributes + ID : 17 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Solar + Max. Text Size : 10 + +Text t9 + Attributes + ID : 19 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 98% + Max. Text Size : 10 + +Text t10 + Attributes + ID : 20 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 2% + Max. Text Size : 10 + +Text t11 + Attributes + ID : 21 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 豈 + Max. Text Size : 4 + +Text t12 + Attributes + ID : 22 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Battery + Max. Text Size : 10 + +Text t13 + Attributes + ID : 24 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 暑 + Max. Text Size : 4 + +Text t14 + Attributes + ID : 25 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Heating + Max. Text Size : 10 + +Text t15 + Attributes + ID : 27 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 1.7 kW + Max. Text Size : 10 + +Text t16 + Attributes + ID : 28 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 21.7°C + Max. Text Size : 10 + +Text t17 + Attributes + ID : 29 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 1.1 kW + Max. Text Size : 10 + +Text t18 + Attributes + ID : 30 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : -2.1 kW + Max. Text Size : 10 + +Text t19 + Attributes + ID : 31 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 0.8 kW + Max. Text Size : 10 + +Text t20 + Attributes + ID : 32 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 慎 + Max. Text Size : 4 + +Text t21 + Attributes + ID : 33 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Wind + Max. Text Size : 10 + +Text t22 + Attributes + ID : 35 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 1.1 kW + Max. Text Size : 10 + +Text t23 + Attributes + ID : 36 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : î—° + Max. Text Size : 4 + +Text t24 + Attributes + ID : 37 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : Car + Max. Text Size : 10 + +Text t25 + Attributes + ID : 39 + Scope : local + Dragging : 0 + Send Component ID : disabled + Associated Keyboard: none + Text : 1.1 kW + Max. Text Size : 10 + +Slider h0 + Attributes + ID : 8 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h1 + Attributes + ID : 13 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h2 + Attributes + ID : 14 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h3 + Attributes + ID : 18 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h4 + Attributes + ID : 23 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h5 + Attributes + ID : 26 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h6 + Attributes + ID : 34 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Slider h7 + Attributes + ID : 38 + Scope : local + Dragging : 0 + Send Component ID: disabled + Position : 50 + Upper range limit: 100 + Lower range limit: 0 + +Button button_back + Attributes + ID : 3 + Scope : local + Dragging : 0 + Send Component ID: on press and release + State : unpressed + Text : î…˜ + Max. Text Size : 3 + + Events + Touch Press Event + page back_page_id + +Timer wakeup_timer + Attributes + ID : 4 + Scope : local + Period (ms): 100 + Enabled : yes + + Events + Timer Event + if(dim 0 else "Unknown" }} - Blueprint (expected): {{ blueprint_version }} continue_on_error: true @@ -9998,7 +9998,6 @@ action: - left_button_state - right_button_state sequence: - ##### SET Hardware Buttons PIC on Home Page #### - *variables_hardware - *update_hw_button_state