From 9c755d453a257deae82cb4e114339ab3364debfe Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Tue, 2 Jan 2024 15:41:41 +0100 Subject: [PATCH] Fix reference to custom buttons on climate page Solves #1481 --- advanced/esphome/nspanel_esphome_core.yaml | 1 - nspanel_blueprint.yaml | 38 +++++++--------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/advanced/esphome/nspanel_esphome_core.yaml b/advanced/esphome/nspanel_esphome_core.yaml index c6f6097..2dd94b9 100644 --- a/advanced/esphome/nspanel_esphome_core.yaml +++ b/advanced/esphome/nspanel_esphome_core.yaml @@ -2481,7 +2481,6 @@ script: disp1->set_component_value("temp_offset", temp_offset); disp1->set_component_value("temp_step", temp_step); disp1->show_component("current_temp"); - disp1->show_component("current_icon"); if (current_temp > -999) disp1->set_component_text_printf("current_temp", "%.1f°", current_temp); else diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index acd57c5..171d5f5 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -9027,43 +9027,29 @@ action: component: button09 - &climate-update_custom_buttons-update repeat: - for_each: '{{ climate_custom_buttons }}' + for_each: '{{ climate_custom_buttons | selectattr("entity", "defined") | list }}' sequence: - condition: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}' - variables: - entity_domain: > - {{ - repeat.item.entity.split(".")[0] - if - repeat.item.entity is defined and - repeat.item.entity is string and - repeat.item.entity.split(".") | count > 0 - else "unknown" - }} - - condition: '{{ entity_domain != "unknown" }}' - - *delay-default + entity_id: '{{ repeat.item.entity }}' + overlap: + icon: '{{ repeat.item.icon }}' + icon_color: '{{ repeat.item.icon_color_rgb }}' + - *variable_entity + - condition: '{{ entity.valid }}' ### ICON Font Color ### + - *delay-default - service: '{{ nextion.command.set_component_color }}' data: - component: 'climate.{{ repeat.item.component }}_icon' - foreground: > - {{ - repeat.item.icon_color_rgb - if states(repeat.item.entity) in ["on", "true", true, "open", "opening"] - else nextion.color.disabled - }} + component: '{{ repeat.item.component }}' + foreground: '{{ entity.icon_color }}' continue_on_error: true ### ICON Font ### - *delay-default - service: '{{ nextion.command.text_printf }}' data: - component: 'climate.{{ repeat.item.component }}_icon' - message: > - {{ - all_icons[repeat.item.icon.split(":")[1]] | default(all_icons.unknown) - if repeat.item.icon is defined and repeat.item.icon is string and ":" in repeat.item.icon and repeat.item.icon.split(":") | count > 0 - else nextion.icon.domain[entity_domain] | default(all_icons.unknown) - }} + component: '{{ repeat.item.component }}' + message: '{{ entity.icon }}' continue_on_error: true ### Enable button click ### - *delay-default