From e8193c2bb7b2fdaab570c7a0c571753168d184c7 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:03:50 +0200 Subject: [PATCH] Fix names on button pages Fix names when a name is not provided in the blueprint settings. --- nspanel_blueprint.yaml | 2 +- nspanel_esphome.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 0a6d622..d077984 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -7425,7 +7425,7 @@ action: {% else %}{{ nextion.icon.domain.unknown }} {% endif %} # LABEL Value - btn_label: '{{ repeat.item.name }}' + btn_label: '{{ repeat.item.name if repeat.item.name is string and repeat.item.name | length > 0 else state_attr(repeat.item.entity, "friendly_name") }}' # BRIGHTNESS Value btn_bri_txt: >- {% if not current_entity_state_available %} 0 diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 2d4a730..e4a82ce 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -347,7 +347,9 @@ api: #entity: string then: - lambda: |- - // ESP_LOGV("nextion", "set button %s", btn_id.c_str()); + ESP_LOGD("service.set_button", "Starting"); + ESP_LOGD("service.set_button", "btn_id: %s", btn_id.c_str()); + ESP_LOGD("service.set_button", "btn_label: %s", btn_label.c_str()); std::string btnicon = btn_id.c_str() + std::string("icon"); std::string btntext = btn_id.c_str() + std::string("text"); std::string btnbri = btn_id.c_str() + std::string("bri"); @@ -365,6 +367,7 @@ api: id(disp1).set_component_text_printf(btnbri.c_str(), " "); id(disp1).set_component_value(btnconf.c_str(), (btn_confirm) ? 1 : 0); //id(disp1).set_component_text_printf(btnentity.c_str(), "%s", entity.c_str()); + ESP_LOGD("service.set_button", "Finished"); ##### SERVICE TO WAKE UP THE DISPLAY ##### - service: wake_up