diff --git a/ReleaseNotes.md b/ReleaseNotes.md index a1fd719..7f6ac2c 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -433,9 +433,11 @@ In this release, we've focused on enhancing the user interface and providing cru Key updates include refined control mechanisms for climate and cover entities, improved functionality for hardware buttons, and the introduction of support for ESPHome's `friendly_name`. -**Breaking Changes:** This update brings a change in handling custom entities. +**Breaking Changes:** +1. **Custom entities naming changed**. If your setup includes custom entities using `${device_name}` in their names, please modify these entities to omit `${device_name}`. ESPHome will now automatically append the `friendly_name` or `device_name` from your substitutions, simplifying the naming process. +2. **Show while loading** input is deprecated and all pages will show components while loading as default. Additionally, we have updated our documentation to include comprehensive guidelines on memory requirements for ESPHome, ensuring users are well-informed for successful system setup and operation. diff --git a/advanced/esphome/nspanel_esphome_core.yaml b/advanced/esphome/nspanel_esphome_core.yaml index 852063a..80698d2 100644 --- a/advanced/esphome/nspanel_esphome_core.yaml +++ b/advanced/esphome/nspanel_esphome_core.yaml @@ -150,7 +150,9 @@ api: variables: cmd: string then: - - lambda: 'disp1->send_command_printf("%s", cmd.c_str());' + - lambda: |- + if (!id(is_uploading_tft)) + disp1->send_command_printf("%s", cmd.c_str()); ##### Service to send a command "text_printf" directly to the display ##### - service: send_command_text_printf @@ -158,7 +160,9 @@ api: component: string message: string then: - - lambda: 'disp1->set_component_text_printf(component.c_str(), "%s", message.c_str());' + - lambda: |- + if (!id(is_uploading_tft)) + disp1->set_component_text_printf(component.c_str(), "%s", message.c_str()); ##### Service to send a command "component_value (Dualstate Button)" directly to the display ##### - service: send_command_value @@ -167,21 +171,26 @@ api: val: int then: - lambda: |- - disp1->set_component_value(component.c_str(), val); + if (!id(is_uploading_tft)) + disp1->set_component_value(component.c_str(), val); ##### Service to send a command "hide componente" directly to the display ##### - service: send_command_hide variables: component: string then: - - lambda: 'disp1->hide_component(component.c_str());' + - lambda: |- + if (!id(is_uploading_tft)) + disp1->hide_component(component.c_str()); ##### Service to send a command "show componente" directly to the display ##### - service: send_command_show variables: component: string then: - - lambda: 'disp1->show_component(component.c_str());' + - lambda: |- + if (!id(is_uploading_tft)) + disp1->show_component(component.c_str()); ##### Service to send a command "font color" directly to the display ##### - service: set_component_color @@ -189,7 +198,9 @@ api: component: string foreground: int[] then: - - lambda: set_component_color->execute(component, foreground); + - lambda: |- + if (!id(is_uploading_tft)) + set_component_color->execute(component, foreground); ##### Service to play a rtttl tones ##### # Example tones : https://codebender.cc/sketch:109888#RTTTL%20Songs.ino @@ -213,7 +224,7 @@ api: then: - lambda: |- // Is page Alarm visible? - if (current_page->state == "alarm") // To do: This page constructor should be moved to Blueprint + if (current_page->state == "alarm" and not id(is_uploading_tft)) // To do: This page constructor should be moved to Blueprint { // Update alarm page detailed_entity->publish_state(entity); @@ -347,19 +358,21 @@ api: message: string then: - lambda: |- - ESP_LOGV("service.notification_show", "Starting"); + if (!id(is_uploading_tft)) { + ESP_LOGV("service.notification_show", "Starting"); - disp1->goto_page("notification"); - disp1->set_component_text_printf("notification.notifi_label", "%s", label.c_str()); + disp1->goto_page("notification"); + disp1->set_component_text_printf("notification.notifi_label", "%s", label.c_str()); - display_wrapped_text->execute("notification.notifi_text01", message.c_str(), display_mode->state == 2 ? 23 : 32); + display_wrapped_text->execute("notification.notifi_text01", message.c_str(), display_mode->state == 2 ? 23 : 32); - notification_label->publish_state(label.c_str()); - notification_text->publish_state(message.c_str()); - timer_reset_all->execute(current_page->state.c_str()); - refresh_notification->execute(); - notification_unread->turn_on(); - if (notification_sound->state) buzzer->play("two short:d=4,o=5,b=100:16e6,16e6"); + notification_label->publish_state(label.c_str()); + notification_text->publish_state(message.c_str()); + timer_reset_all->execute(current_page->state.c_str()); + refresh_notification->execute(); + notification_unread->turn_on(); + if (notification_sound->state) buzzer->play("two short:d=4,o=5,b=100:16e6,16e6"); + } ##### Service to clear the notification ##### - service: notification_clear @@ -393,9 +406,11 @@ api: show: bool then: - lambda: |- - disp1->set_component_text_printf("qrcode.qrcode_label", "%s", title.c_str()); - disp1->set_component_text_printf("qrcode.qrcode_value", "%s", qrcode.c_str()); - if (show) disp1->goto_page("qrcode"); + if (!id(is_uploading_tft)) { + disp1->set_component_text_printf("qrcode.qrcode_label", "%s", title.c_str()); + disp1->set_component_text_printf("qrcode.qrcode_value", "%s", qrcode.c_str()); + if (show) disp1->goto_page("qrcode"); + } #### Service to set climate state #### - service: set_climate @@ -412,20 +427,24 @@ api: embedded_climate: bool entity: string then: - - lambda: |- - if (current_page->state == "climate") detailed_entity->publish_state(entity); - - script.execute: - id: set_climate - current_temp: !lambda "return current_temp;" - supported_features: !lambda "return supported_features;" - target_temp: !lambda "return target_temp;" - target_temp_high: !lambda "return target_temp_high;" - target_temp_low: !lambda "return target_temp_low;" - temp_step: !lambda "return temp_step;" - total_steps: !lambda "return total_steps;" - temp_offset: !lambda "return temp_offset;" - climate_icon: !lambda "return climate_icon;" - embedded_climate: !lambda "return embedded_climate;" + - if: + condition: + lambda: 'return not id(is_uploading_tft);' + then: + - lambda: |- + if (current_page->state == "climate") detailed_entity->publish_state(entity); + - script.execute: + id: set_climate + current_temp: !lambda "return current_temp;" + supported_features: !lambda "return supported_features;" + target_temp: !lambda "return target_temp;" + target_temp_high: !lambda "return target_temp_high;" + target_temp_low: !lambda "return target_temp_low;" + temp_step: !lambda "return temp_step;" + total_steps: !lambda "return total_steps;" + temp_offset: !lambda "return temp_offset;" + climate_icon: !lambda "return climate_icon;" + embedded_climate: !lambda "return embedded_climate;" #### Service to set the buttons #### - service: set_button @@ -440,11 +459,11 @@ api: label: string then: - lambda: |- - static const char *const TAG = "service.set_button"; - if (page == current_page->state) { + if (page == current_page->state and not id(is_uploading_tft)) { std::string btnicon = id.c_str() + std::string("icon"); std::string btntext = id.c_str() + std::string("text"); std::string btnbri = id.c_str() + std::string("bri"); + std::string btnpic = id.c_str() + std::string("pic"); uint8_t bg_pic = state ? 47 : 46; uint16_t txt_color = state ? 10597 : 65535; disp1->send_command_printf("%spic.picc=%u", id.c_str(), bg_pic); @@ -461,8 +480,13 @@ api: disp1->set_component_text_printf(btnbri.c_str(), "%s", bri.c_str()); else disp1->set_component_text_printf(btnbri.c_str(), " "); + disp1->show_component(btnpic.c_str()); + disp1->show_component(btnicon.c_str()); + disp1->show_component(btntext.c_str()); + disp1->show_component(btnbri.c_str()); + disp1->show_component(id.c_str()); } else { - ESP_LOGW(TAG, "Skipping button `%s.%s` as page has changed to %s.", page.c_str(), id.c_str(), current_page->state.c_str()); + ESP_LOGW("service.set_button", "Skipping button `%s.%s` update.", page.c_str(), id.c_str()); } ##### SERVICE TO WAKE UP THE DISPLAY ##### @@ -471,12 +495,14 @@ api: reset_timer: bool then: - lambda: |- - if (current_page->state == "screensaver") disp1->goto_page(wakeup_page_name->state.c_str()); - if (reset_timer) - timer_reset_all->execute(wakeup_page_name->state.c_str()); - else { - timer_sleep->execute(wakeup_page_name->state.c_str(), int(timeout_sleep->state)); - timer_dim->execute(wakeup_page_name->state.c_str(), int(timeout_dim->state)); + if (not id(is_uploading_tft)) { + if (current_page->state == "screensaver") disp1->goto_page(wakeup_page_name->state.c_str()); + if (reset_timer) + timer_reset_all->execute(wakeup_page_name->state.c_str()); + else { + timer_sleep->execute(wakeup_page_name->state.c_str(), int(timeout_sleep->state)); + timer_dim->execute(wakeup_page_name->state.c_str(), int(timeout_dim->state)); + } } #### Service to set the entities #### @@ -489,14 +515,16 @@ api: ent_value_xcen: string then: - lambda: |- - std::string enticon = ent_id.c_str() + std::string("_pic"); - std::string entlabel = ent_id.c_str() + std::string("_label"); - std::string entxcen = ent_id.c_str() + std::string(".xcen=") + ent_value_xcen.c_str(); - disp1->set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str()); - if (strcmp(ent_icon.c_str(), "0") != 0) disp1->set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str()); - disp1->set_component_text_printf(entlabel.c_str(), "%s", ent_label.c_str()); - disp1->set_component_text_printf(ent_id.c_str(), "%s", ent_value.c_str()); - if (strcmp(ent_value_xcen.c_str(), "0") != 0) disp1->send_command_printf("%s", entxcen.c_str()); + if (not id(is_uploading_tft)) { + std::string enticon = ent_id.c_str() + std::string("_pic"); + std::string entlabel = ent_id.c_str() + std::string("_label"); + std::string entxcen = ent_id.c_str() + std::string(".xcen=") + ent_value_xcen.c_str(); + disp1->set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str()); + if (strcmp(ent_icon.c_str(), "0") != 0) disp1->set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str()); + disp1->set_component_text_printf(entlabel.c_str(), "%s", ent_label.c_str()); + disp1->set_component_text_printf(ent_id.c_str(), "%s", ent_value.c_str()); + if (strcmp(ent_value_xcen.c_str(), "0") != 0) disp1->send_command_printf("%s", entxcen.c_str()); + } #### Service to populate the page Home ##### - service: page_home @@ -518,73 +546,75 @@ api: entities_pages_icon_color: int[] then: - lambda: |- - static const char *const TAG = "service.page_home"; - ESP_LOGV(TAG, "date_color: %" PRIi32, date_color); - ESP_LOGV(TAG, "time_format: %s", time_format.c_str()); - ESP_LOGV(TAG, "time_color: %" PRIi32, time_color); - ESP_LOGV(TAG, "meridiem: %i", meridiem.size()); - ESP_LOGV(TAG, "chip_font_size: %" PRIi32, chip_font_size); - ESP_LOGV(TAG, "custom_buttons_font_size: %" PRIi32, custom_buttons_font_size); - 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", qrcode ? "True" : "False"); - 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", entities_pages ? "True" : "False"); - 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()); + if (not id(is_uploading_tft)) { + static const char *const TAG = "service.page_home"; + ESP_LOGV(TAG, "date_color: %" PRIi32, date_color); + ESP_LOGV(TAG, "time_format: %s", time_format.c_str()); + ESP_LOGV(TAG, "time_color: %" PRIi32, time_color); + ESP_LOGV(TAG, "meridiem: %i", meridiem.size()); + ESP_LOGV(TAG, "chip_font_size: %" PRIi32, chip_font_size); + ESP_LOGV(TAG, "custom_buttons_font_size: %" PRIi32, custom_buttons_font_size); + 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", qrcode ? "True" : "False"); + 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", entities_pages ? "True" : "False"); + 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()); - // Localization - ESP_LOGV(TAG, "Load localization"); - id(mui_time_format) = time_format; - id(mui_meridiem) = meridiem; + // Localization + ESP_LOGV(TAG, "Load localization"); + id(mui_time_format) = time_format; + id(mui_meridiem) = meridiem; - // Date/Time colors - ESP_LOGV(TAG, "Load date/time colors"); - disp1->set_component_font_color("home.date", date_color); - disp1->set_component_font_color("home.time", time_color); - id(home_date_color) = date_color; - id(home_time_color) = time_color; + // Date/Time colors + ESP_LOGV(TAG, "Load date/time colors"); + disp1->set_component_font_color("home.date", date_color); + disp1->set_component_font_color("home.time", time_color); + id(home_date_color) = date_color; + id(home_time_color) = time_color; - // Chips icon size - ESP_LOGV(TAG, "Chips size"); - for (int i = 1; i <= 10; ++i) { - disp1->send_command_printf("home.icon_top_%02d.font=%" PRIu32, i, chip_font_size); + // Chips icon size + ESP_LOGV(TAG, "Chips size"); + for (int i = 1; i <= 10; ++i) { + disp1->send_command_printf("home.icon_top_%02d.font=%" PRIu32, i, chip_font_size); + } + disp1->send_command_printf("home.wifi_icon.font=%" PRIu32, chip_font_size); + id(home_chip_font_size) = chip_font_size; + + // Custom buttons icon size + ESP_LOGV(TAG, "Custom buttons sizes"); + id(home_custom_buttons_font_size) = custom_buttons_font_size; + for (int i = 1; i <= 7; ++i) { + disp1->send_command_printf("home.button%02d.font=%i", i, id(home_custom_buttons_font_size)); + } + disp1->send_command_printf("home.bt_notific.font=%i", id(home_custom_buttons_font_size)); + disp1->send_command_printf("home.bt_qrcode.font=%i", id(home_custom_buttons_font_size)); + disp1->send_command_printf("home.bt_entities.font=%i", id(home_custom_buttons_font_size)); + + // 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()); + set_component_color->execute("home.bt_notific", notification_unread->state ? notification_icon_color_unread : notification_icon_color_normal); + id(home_notify_icon_color_normal) = notification_icon_color_normal; + id(home_notify_icon_color_unread) = notification_icon_color_unread; + + // 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()); + set_component_color->execute("home.bt_qrcode", qrcode_icon_color); + + // 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()); + //set_component_color->execute("home.bt_entities", entities_pages_icon_color); + set_component_color->execute("home.bt_entities", entities_pages_icon_color); } - disp1->send_command_printf("home.wifi_icon.font=%" PRIu32, chip_font_size); - id(home_chip_font_size) = chip_font_size; - - // Custom buttons icon size - ESP_LOGV(TAG, "Custom buttons sizes"); - id(home_custom_buttons_font_size) = custom_buttons_font_size; - for (int i = 1; i <= 7; ++i) { - disp1->send_command_printf("home.button%02d.font=%i", i, id(home_custom_buttons_font_size)); - } - disp1->send_command_printf("home.bt_notific.font=%i", id(home_custom_buttons_font_size)); - disp1->send_command_printf("home.bt_qrcode.font=%i", id(home_custom_buttons_font_size)); - disp1->send_command_printf("home.bt_entities.font=%i", id(home_custom_buttons_font_size)); - - // 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()); - set_component_color->execute("home.bt_notific", notification_unread->state ? notification_icon_color_unread : notification_icon_color_normal); - id(home_notify_icon_color_normal) = notification_icon_color_normal; - id(home_notify_icon_color_unread) = notification_icon_color_unread; - - // 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()); - set_component_color->execute("home.bt_qrcode", qrcode_icon_color); - - // 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()); - //set_component_color->execute("home.bt_entities", entities_pages_icon_color); - set_component_color->execute("home.bt_entities", entities_pages_icon_color); #### Service to populate the page Settings ##### - service: page_settings @@ -595,10 +625,12 @@ api: dim: string then: - lambda: |- - if (not reboot.empty()) disp1->set_component_text_printf("settings.lbl_reboot", " %s", reboot.c_str()); - disp1->set_component_text_printf("settings.lbl_brightness", " %s", brightness.c_str()); - display_wrapped_text->execute("settings.lbl_bright", bright.c_str(), display_mode->state == 2 ? 25 : 10); - display_wrapped_text->execute("settings.lbl_dim", dim.c_str(), display_mode->state == 2 ? 25 : 10); + if (not id(is_uploading_tft)) { + if (not reboot.empty()) disp1->set_component_text_printf("settings.lbl_reboot", " %s", reboot.c_str()); + disp1->set_component_text_printf("settings.lbl_brightness", " %s", brightness.c_str()); + display_wrapped_text->execute("settings.lbl_bright", bright.c_str(), display_mode->state == 2 ? 25 : 10); + display_wrapped_text->execute("settings.lbl_dim", dim.c_str(), display_mode->state == 2 ? 25 : 10); + } #### Service to populate the media player page ##### - service: media_player @@ -616,106 +648,85 @@ api: supported_features: int then: - lambda: |- - if (current_page->state == "media_player") - { - detailed_entity->publish_state(entity); - disp1->set_component_text_printf("page_label", "%s", friendly_name.c_str()); - display_wrapped_text->execute("track", media_title.c_str(), display_mode->state == 2 ? 16 : 27); - display_wrapped_text->execute("artist", media_artist.c_str(), display_mode->state == 2 ? 26 : 40); + if (current_page->state == "media_player" and not id(is_uploading_tft)) { + detailed_entity->publish_state(entity); + disp1->set_component_text_printf("page_label", "%s", friendly_name.c_str()); + display_wrapped_text->execute("track", media_title.c_str(), display_mode->state == 2 ? 16 : 27); + display_wrapped_text->execute("artist", media_artist.c_str(), display_mode->state == 2 ? 26 : 40); - // on/off button - if (supported_features & 128 and state == "off") //TURN_ON - { - disp1->set_component_foreground_color("bt_on_off", 65535); - disp1->show_component("bt_on_off"); - } - else if (supported_features & 256 and state != "off") //TURN_OFF - { - disp1->set_component_foreground_color("bt_on_off", 10597); - disp1->show_component("bt_on_off"); - } - else disp1->hide_component("bt_on_off"); + // on/off button + if (supported_features & 128 and state == "off") { //TURN_ON + disp1->set_component_foreground_color("bt_on_off", 65535); + disp1->show_component("bt_on_off"); + } else if (supported_features & 256 and state != "off") { //TURN_OFF + disp1->set_component_foreground_color("bt_on_off", 10597); + disp1->show_component("bt_on_off"); + } else disp1->hide_component("bt_on_off"); - // play/pause button - if ((supported_features & 512 or supported_features & 16384) and state != "playing" and state != "off") //PLAY_MEDIA+PLAY - { - disp1->set_component_text_printf("bt_play_pause", "%s", "\uE409"); // mdi:play - disp1->show_component("bt_play_pause"); - } - else if (supported_features & 1 and state == "playing" ) //PAUSE - { - disp1->set_component_text_printf("bt_play_pause", "%s", "\uE3E3"); // mdi:pause - disp1->show_component("bt_play_pause"); - } - else disp1->hide_component("bt_play_pause"); + // play/pause button + if ((supported_features & 512 or supported_features & 16384) and state != "playing" and state != "off") { //PLAY_MEDIA+PLAY + disp1->set_component_text_printf("bt_play_pause", "%s", "\uE409"); // mdi:play + disp1->show_component("bt_play_pause"); + } else if (supported_features & 1 and state == "playing" ) { //PAUSE + disp1->set_component_text_printf("bt_play_pause", "%s", "\uE3E3"); // mdi:pause + disp1->show_component("bt_play_pause"); + } else disp1->hide_component("bt_play_pause"); - // bt_prev button - PREVIOUS_TRACK - if (supported_features & 16 and state != "off") disp1->show_component("bt_prev"); else disp1->hide_component("bt_prev"); - // bt_next button - NEXT_TRACK - if (supported_features & 32 and state != "off") disp1->show_component("bt_next"); else disp1->hide_component("bt_next"); + // bt_prev button - PREVIOUS_TRACK + if (supported_features & 16 and state != "off") disp1->show_component("bt_prev"); else disp1->hide_component("bt_prev"); + // bt_next button - NEXT_TRACK + if (supported_features & 32 and state != "off") disp1->show_component("bt_next"); else disp1->hide_component("bt_next"); - // Stop button - STOP - //if (supported_features & 4096 and (state == "playing" or state == "paused")) disp1->show_component("bt_stop"); else disp1->hide_component("bt_stop"); + // Stop button - STOP + //if (supported_features & 4096 and (state == "playing" or state == "paused")) disp1->show_component("bt_stop"); else disp1->hide_component("bt_stop"); - // mute/unmute button - VOLUME_MUTE - disp1->set_component_value("is_muted", is_volume_muted ? 1 : 0); - if (supported_features & 8 and is_volume_muted) // unmute - { - disp1->set_component_text_printf("bt_mute", "%s", "\uEE07"); // mdi:volume-variant-off - disp1->show_component("bt_mute"); - } - else if (supported_features & 8) // mute - { - disp1->set_component_text_printf("bt_mute", "%s", "\uE57E"); // mdi:volume-low - disp1->show_component("bt_mute"); - } - else disp1->hide_component("bt_mute"); + // mute/unmute button - VOLUME_MUTE + disp1->set_component_value("is_muted", is_volume_muted ? 1 : 0); + if (supported_features & 8 and is_volume_muted) { // unmute + disp1->set_component_text_printf("bt_mute", "%s", "\uEE07"); // mdi:volume-variant-off + disp1->show_component("bt_mute"); + } else if (supported_features & 8) { // mute + disp1->set_component_text_printf("bt_mute", "%s", "\uE57E"); // mdi:volume-low + disp1->show_component("bt_mute"); + } else disp1->hide_component("bt_mute"); - // VOLUME_SET - if (supported_features & 4) - { - if (volume_level != id(last_volume_level)) - { - id(last_volume_level) = volume_level; - disp1->set_component_text_printf("vol_text", "%" PRIu32 "%%", volume_level); - disp1->set_component_value("vol_slider", volume_level); - } - disp1->show_component("vol_slider"); - disp1->show_component("bt_vol_down"); - disp1->show_component("bt_vol_up"); - disp1->show_component("vol_text"); - } - else - { - disp1->hide_component("vol_slider"); - disp1->hide_component("bt_vol_down"); - disp1->hide_component("bt_vol_up"); - disp1->hide_component("vol_text"); - } - - if (media_duration > 0) - { - if (media_duration != id(last_media_duration) or media_position != id(last_media_position)) - { - id(last_media_duration) = media_duration; - id(last_media_position) = media_position; - disp1->set_component_value("prg_current", int(round(min(media_position + media_position_delta, media_duration)))); - } - disp1->set_component_value("prg_total", int(round(media_duration))); - disp1->send_command_printf("prg_timer.en=%i", (state == "playing") ? 1 : 0); - disp1->show_component("time_current"); - disp1->show_component("time_total"); - disp1->show_component("time_progress"); - } - else - { - disp1->send_command_printf("prg_timer.en=0"); - disp1->hide_component("time_current"); - disp1->hide_component("time_total"); - disp1->hide_component("time_progress"); - } + // VOLUME_SET + if (supported_features & 4) { + if (volume_level != id(last_volume_level)) { + id(last_volume_level) = volume_level; + disp1->set_component_text_printf("vol_text", "%" PRIu32 "%%", volume_level); + disp1->set_component_value("vol_slider", volume_level); + } + disp1->show_component("vol_slider"); + disp1->show_component("bt_vol_down"); + disp1->show_component("bt_vol_up"); + disp1->show_component("vol_text"); + } else { + disp1->hide_component("vol_slider"); + disp1->hide_component("bt_vol_down"); + disp1->hide_component("bt_vol_up"); + disp1->hide_component("vol_text"); } + if (media_duration > 0) { + if (media_duration != id(last_media_duration) or media_position != id(last_media_position)) { + id(last_media_duration) = media_duration; + id(last_media_position) = media_position; + disp1->set_component_value("prg_current", int(round(min(media_position + media_position_delta, media_duration)))); + } + disp1->set_component_value("prg_total", int(round(media_duration))); + disp1->send_command_printf("prg_timer.en=%i", (state == "playing") ? 1 : 0); + disp1->show_component("time_current"); + disp1->show_component("time_total"); + disp1->show_component("time_progress"); + } else { + disp1->send_command_printf("prg_timer.en=0"); + disp1->hide_component("time_current"); + disp1->hide_component("time_total"); + disp1->hide_component("time_progress"); + } + } + ##### START - DISPLAY START CONFIGURATION ##### display: - id: disp1 @@ -1804,6 +1815,7 @@ script: value: string then: - lambda: |- + if (id(is_uploading_tft)) change_climate_state->stop(); if (!embedded) { if (key == "temperature" or key == "target_temp_high" or key == "target_temp_low") ha_call_service->execute("climate.set_temperature", key.c_str(), to_string(stof(value) / 10), detailed_entity->state.c_str()); @@ -1830,6 +1842,7 @@ script: return (compareVersions("${version}", version_tft->state.c_str()) and compareVersions("${version}", version_blueprint->state.c_str())); timeout: 60s - lambda: |- + if (id(is_uploading_tft)) check_versions->stop(); static const char *const TAG = "script.check_versions"; auto compareVersions = [](const char* version1, const char* version2) -> bool { @@ -1917,6 +1930,7 @@ script: screensaver_time_color: int32_t[] 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"); @@ -1999,6 +2013,7 @@ script: command: string then: - lambda: |- + if (id(is_uploading_tft)) ha_button->stop(); timer_reset_all->execute(page.c_str()); auto ha_event = new esphome::api::CustomAPIDevice(); ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint", @@ -2018,6 +2033,7 @@ 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"); @@ -2053,11 +2069,13 @@ script: mode: restart then: - lambda: |- - notification_label->publish_state(""); - notification_text->publish_state(""); - notification_unread->turn_off(); - refresh_notification->execute(); - if (current_page->state == "notification") disp1->goto_page("home"); + if (not id(is_uploading_tft)) { + notification_label->publish_state(""); + notification_text->publish_state(""); + notification_unread->turn_off(); + refresh_notification->execute(); + if (current_page->state == "notification") disp1->goto_page("home"); + } - id: open_entity_settings_page mode: restart @@ -2070,22 +2088,24 @@ script: back_page: string then: - lambda: |- - detailed_entity->publish_state(entity); - if (page == "alarm_control_panel") page = "alarm"; - std::string cmd_page = std::string("page ") + page.c_str(); - disp1->send_command_printf(cmd_page.c_str()); - if (page_label.find("\\r") != std::string::npos) - page_label = page_label.replace(page_label.find("\\r"), 2, " "); - disp1->set_component_text_printf("page_label", "%s", page_label.c_str()); - set_page_id->execute("back_page_id", back_page.c_str()); - if (page == "climate") - disp1->set_component_value("embedded", (entity == "embedded_climate") ? 1 : 0); - else - { - if ((page_icon != std::string()) and (page_icon != "")) - disp1->set_component_text_printf("icon_state", "%s", page_icon.c_str()); - set_component_color->execute("icon_state", page_icon_color); - } + if (not id(is_uploading_tft)) { + detailed_entity->publish_state(entity); + if (page == "alarm_control_panel") page = "alarm"; + std::string cmd_page = std::string("page ") + page.c_str(); + disp1->send_command_printf(cmd_page.c_str()); + if (page_label.find("\\r") != std::string::npos) + page_label = page_label.replace(page_label.find("\\r"), 2, " "); + disp1->set_component_text_printf("page_label", "%s", page_label.c_str()); + set_page_id->execute("back_page_id", back_page.c_str()); + if (page == "climate") + disp1->set_component_value("embedded", (entity == "embedded_climate") ? 1 : 0); + else + { + if ((page_icon != std::string()) and (page_icon != "")) + disp1->set_component_text_printf("icon_state", "%s", page_icon.c_str()); + set_component_color->execute("icon_state", page_icon_color); + } + } - id: page_alarm mode: restart @@ -2461,6 +2481,11 @@ script: relay2_icon_color: int relay2_fallback: bool then: + - if: + condition: + lambda: 'return id(is_uploading_tft);' + then: + - script.stop: relay_settings - lambda: |- static const char *const TAG = "script.relay_settings"; // Relays @@ -2684,6 +2709,7 @@ script: foreground: int32_t[] then: - lambda: |- + if (id(is_uploading_tft)) set_component_color->stop(); static const char *const TAG = "script.set_component_color"; ESP_LOGVV(TAG, "Starting:"); ESP_LOGVV(TAG, " Component: %s", component.c_str()); diff --git a/advanced/hmi/nspanel_eu.HMI b/advanced/hmi/nspanel_eu.HMI index 9a14ef4..7e8b6fb 100644 Binary files a/advanced/hmi/nspanel_eu.HMI and b/advanced/hmi/nspanel_eu.HMI differ diff --git a/advanced/hmi/nspanel_eu_code/buttonpage01.txt b/advanced/hmi/nspanel_eu_code/buttonpage01.txt index 8cca477..9446a71 100644 --- a/advanced/hmi/nspanel_eu_code/buttonpage01.txt +++ b/advanced/hmi/nspanel_eu_code/buttonpage01.txt @@ -21,7 +21,6 @@ Page buttonpage01 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_eu_code/buttonpage02.txt b/advanced/hmi/nspanel_eu_code/buttonpage02.txt index 14c72c3..87af814 100644 --- a/advanced/hmi/nspanel_eu_code/buttonpage02.txt +++ b/advanced/hmi/nspanel_eu_code/buttonpage02.txt @@ -21,7 +21,6 @@ Page buttonpage02 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_eu_code/buttonpage03.txt b/advanced/hmi/nspanel_eu_code/buttonpage03.txt index ce083cb..bb36625 100644 --- a/advanced/hmi/nspanel_eu_code/buttonpage03.txt +++ b/advanced/hmi/nspanel_eu_code/buttonpage03.txt @@ -21,7 +21,6 @@ Page buttonpage03 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_eu_code/buttonpage04.txt b/advanced/hmi/nspanel_eu_code/buttonpage04.txt index 20e3e47..38c8cdd 100644 --- a/advanced/hmi/nspanel_eu_code/buttonpage04.txt +++ b/advanced/hmi/nspanel_eu_code/buttonpage04.txt @@ -21,7 +21,6 @@ Page buttonpage04 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_eu_code/home.txt b/advanced/hmi/nspanel_eu_code/home.txt index 998e7a9..a6a5668 100644 --- a/advanced/hmi/nspanel_eu_code/home.txt +++ b/advanced/hmi/nspanel_eu_code/home.txt @@ -290,7 +290,7 @@ Text wifi_icon Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 5 Events @@ -326,7 +326,7 @@ Text bt_notific Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events @@ -343,7 +343,7 @@ Text bt_qrcode Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events @@ -357,7 +357,7 @@ Text bt_entities Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events diff --git a/advanced/hmi/nspanel_us.HMI b/advanced/hmi/nspanel_us.HMI index cf8a700..f0bb55d 100644 Binary files a/advanced/hmi/nspanel_us.HMI and b/advanced/hmi/nspanel_us.HMI differ diff --git a/advanced/hmi/nspanel_us_code/buttonpage01.txt b/advanced/hmi/nspanel_us_code/buttonpage01.txt index 8cca477..9446a71 100644 --- a/advanced/hmi/nspanel_us_code/buttonpage01.txt +++ b/advanced/hmi/nspanel_us_code/buttonpage01.txt @@ -21,7 +21,6 @@ Page buttonpage01 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_code/buttonpage02.txt b/advanced/hmi/nspanel_us_code/buttonpage02.txt index 14c72c3..87af814 100644 --- a/advanced/hmi/nspanel_us_code/buttonpage02.txt +++ b/advanced/hmi/nspanel_us_code/buttonpage02.txt @@ -21,7 +21,6 @@ Page buttonpage02 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_code/buttonpage03.txt b/advanced/hmi/nspanel_us_code/buttonpage03.txt index ce083cb..bb36625 100644 --- a/advanced/hmi/nspanel_us_code/buttonpage03.txt +++ b/advanced/hmi/nspanel_us_code/buttonpage03.txt @@ -21,7 +21,6 @@ Page buttonpage03 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_code/buttonpage04.txt b/advanced/hmi/nspanel_us_code/buttonpage04.txt index 20e3e47..38c8cdd 100644 --- a/advanced/hmi/nspanel_us_code/buttonpage04.txt +++ b/advanced/hmi/nspanel_us_code/buttonpage04.txt @@ -21,7 +21,6 @@ Page buttonpage04 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_code/home.txt b/advanced/hmi/nspanel_us_code/home.txt index 998e7a9..a6a5668 100644 --- a/advanced/hmi/nspanel_us_code/home.txt +++ b/advanced/hmi/nspanel_us_code/home.txt @@ -290,7 +290,7 @@ Text wifi_icon Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 5 Events @@ -326,7 +326,7 @@ Text bt_notific Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events @@ -343,7 +343,7 @@ Text bt_qrcode Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events @@ -357,7 +357,7 @@ Text bt_entities Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events diff --git a/advanced/hmi/nspanel_us_land.HMI b/advanced/hmi/nspanel_us_land.HMI index 58d61c3..69ff7b5 100644 Binary files a/advanced/hmi/nspanel_us_land.HMI and b/advanced/hmi/nspanel_us_land.HMI differ diff --git a/advanced/hmi/nspanel_us_land_code/buttonpage01.txt b/advanced/hmi/nspanel_us_land_code/buttonpage01.txt index 8cca477..9446a71 100644 --- a/advanced/hmi/nspanel_us_land_code/buttonpage01.txt +++ b/advanced/hmi/nspanel_us_land_code/buttonpage01.txt @@ -21,7 +21,6 @@ Page buttonpage01 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_land_code/buttonpage02.txt b/advanced/hmi/nspanel_us_land_code/buttonpage02.txt index 14c72c3..87af814 100644 --- a/advanced/hmi/nspanel_us_land_code/buttonpage02.txt +++ b/advanced/hmi/nspanel_us_land_code/buttonpage02.txt @@ -21,7 +21,6 @@ Page buttonpage02 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_land_code/buttonpage03.txt b/advanced/hmi/nspanel_us_land_code/buttonpage03.txt index ce083cb..bb36625 100644 --- a/advanced/hmi/nspanel_us_land_code/buttonpage03.txt +++ b/advanced/hmi/nspanel_us_land_code/buttonpage03.txt @@ -21,7 +21,6 @@ Page buttonpage03 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_land_code/buttonpage04.txt b/advanced/hmi/nspanel_us_land_code/buttonpage04.txt index 20e3e47..38c8cdd 100644 --- a/advanced/hmi/nspanel_us_land_code/buttonpage04.txt +++ b/advanced/hmi/nspanel_us_land_code/buttonpage04.txt @@ -21,7 +21,6 @@ Page buttonpage04 vis button_back,1 vis page_index,1 } - vis unavailable,0 Postinitialize Event sendme diff --git a/advanced/hmi/nspanel_us_land_code/home.txt b/advanced/hmi/nspanel_us_land_code/home.txt index 998e7a9..a6a5668 100644 --- a/advanced/hmi/nspanel_us_land_code/home.txt +++ b/advanced/hmi/nspanel_us_land_code/home.txt @@ -290,7 +290,7 @@ Text wifi_icon Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 5 Events @@ -326,7 +326,7 @@ Text bt_notific Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events @@ -343,7 +343,7 @@ Text bt_qrcode Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events @@ -357,7 +357,7 @@ Text bt_entities Dragging : 0 Send Component ID : on press and release Associated Keyboard: none - Text :  + Text : Max. Text Size : 3 Events diff --git a/dev/ui/eu/pics/NSPanel - EU.pptx b/dev/ui/eu/pics/NSPanel - EU.pptx index e89ea4d..6a0bdf9 100644 Binary files a/dev/ui/eu/pics/NSPanel - EU.pptx and b/dev/ui/eu/pics/NSPanel - EU.pptx differ diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 70b916e..070b3d3 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -3211,19 +3211,6 @@ blueprint: default: [] selector: text: {} - ##### Show while loading ##### - show_while_loading: - name: Show pages while loading? - description: > - *SYSTEM settings* - - *When this is enable (default), the pages will be shown earlier, but some information might not be visible from the begining and will be shown when available.* - *When disabled, the pages will be shown when all the data is loaded and ready to be displayed.* - - **This may be useful when your pages takes too long to load and can help you identifying the elements slowing down the page construction.** - default: true - selector: - boolean: ##### Media player update ##### media_player_update_interval: name: Media player - Update interval @@ -8029,16 +8016,6 @@ action: component: confirm val: '{{ confirm_value }}' continue_on_error: true - ###### Display page while other elements are still loading ##### - - variables: - show_while_loading: !input 'show_while_loading' - - if: '{{ show_while_loading }}' - then: - - *delay-default - - service: '{{ nextion.command.show }}' - data: - component: '255' # all components - continue_on_error: true ##### NSPanel build Button page ##### - repeat: @@ -8113,21 +8090,6 @@ action: bri: '{{ btn_bri_txt }}' label: '{{ entity.name }}' continue_on_error: true - ###### SHOW All component when page loading done ##### - - if: '{{ not show_while_loading }}' - then: - - *delay-default - - service: '{{ nextion.command.show }}' - data: - component: '255' # all components - continue_on_error: true - else: - ###### Show empty page ##### - - *delay-default - - service: '{{ nextion.command.show }}' - data: - component: '255' # all components - continue_on_error: true ## PAGE LIGHT ## - alias: Light settings page diff --git a/nspanel_eu.tft b/nspanel_eu.tft index 588f410..7eb8782 100644 Binary files a/nspanel_eu.tft and b/nspanel_eu.tft differ diff --git a/nspanel_us.tft b/nspanel_us.tft index 0ef99d3..cba2ab6 100644 Binary files a/nspanel_us.tft and b/nspanel_us.tft differ diff --git a/nspanel_us_land.tft b/nspanel_us_land.tft index 95f89ef..5af5dae 100644 Binary files a/nspanel_us_land.tft and b/nspanel_us_land.tft differ