diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index ca15f6d..c8940dc 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -471,10 +471,19 @@ api: if (!id(is_uploading_tft) and !(id.empty())) { if (!(icon.empty())) disp1->set_component_text_printf("%s_icon", id.c_str(), icon.c_str()); if (icon_color.size() == 3) set_component_color->execute((id + "_icon").c_str(), icon_color); - if (visible) { - disp1->show_component(id.c_str()); - } else { - disp1->hide_component(id.c_str()); + bool IsCurrentPage = true; + size_t dotPos = id.find("."); + if (dotPos != std::string::npos) { + std::string left_side = id.substr(0, dotPos); + if (left_side == "alarm_control_panel") left_side = "alarm"; + if (left_side != current_page->state) IsCurrentPage = false; + } + if (IsCurrentPage) { + if (visible) { + disp1->show_component(id.c_str()); + } else { + disp1->hide_component(id.c_str()); + } } } diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 2542cbe..2fd67c1 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -3412,6 +3412,7 @@ variables: text: 'esphome.{{ nspanel_name }}_component_text' value: 'esphome.{{ nspanel_name }}_component_value' detailed_entity: 'esphome.{{ nspanel_name }}_entity_details_show' + icon: 'esphome.{{ nspanel_name }}_icon' init: global: 'esphome.{{ nspanel_name }}_init_global' page: @@ -7490,7 +7491,7 @@ action: id: 'home.{{ repeat.item.component }}' icon: '{{ entity.icon if entity.icon is defined else "" }}' icon_color: '{{ entity.icon_color if entity.icon_color is defined else [] }}' - visible: '{{ page.current == page.home }}' + visible: true continue_on_error: true else: - if: '{{ page.current == page.home }}' @@ -7507,38 +7508,13 @@ action: - variables: entity_id: '{{ climate }}' - *variable_entity - - if: '{{ has_value(entity_id) }}' - then: - - variables: - entity_hvac_action: '{{ state_attr(entity_id, "hvac_action") }}' - entity_climate_action: '{{ (entity_hvac_action if entity_hvac_action and entity_hvac_action not in enum.states.unknown else entity_state) }}' - - if: > - {{ - entity_climate_action and - entity_climate_action in ["off", "heating", "heat", "cooling", "cool", "dry", "drying", "fan", "fan_only", "heat_cool", "auto", "idle"] - }} - then: - ### ICON Font Color ### - - service: '{{ nspanel.service.component.color }}' - data: - id: home.icon_top_03 - color: '{{ entity.icon_color }}' - continue_on_error: true - ### ICON Font ### - - service: '{{ nspanel.service.component.text }}' - data: - id: home.icon_top_03 - txt: '{{ entity.icon }}' - continue_on_error: true - else: - - &hide-home_page-climate_chip - service: '{{ nspanel.service.component.text }}' - data: - id: home.icon_top_03 - txt: '{{ all_icons.blank }}' - continue_on_error: true - else: - - *hide-home_page-climate_chip + - service: '{{ nspanel.service.icon }}' + data: + id: home.icon_top_03 + icon: '{{ entity.icon if entity.icon is defined else "" }}' + icon_color: '{{ entity.icon_color if entity.icon_color is defined else [] }}' + visible: '{{ entity_has_value and entity_state in ["heating", "cooling", "drying", "fan_only"] }}' + continue_on_error: true ###### Status / Chips bar ###### - &variables_home_page_status_bar