diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 9c5d41b..4f2dd5f 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -4031,6 +4031,11 @@ action: - variables: repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}" repeat_item_state_is_on: "{{ repeat_item_state in ['on', 'open'] }}" + repeat_item_icon: > + {% if repeat_item_state_is_on and repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon) }} + {% elif repeat_item_state_is_on and state_attr(repeat.item.entity, 'icon') | default('') not in ['unavailable', 'unknown', '', None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, 'icon').split(':')[1]] | default(nextion.icons.blank) }} + {% else %}{{ nextion.icons.blank }} + {% endif %} - if: "{{ repeat_item_state_is_on }}" then: ### ICON Font Color ### @@ -4045,7 +4050,7 @@ action: - service: "{{ nextion.commands.text_printf }}" data: component: "{{ repeat.item.component }}" - message: "{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon if repeat.item.icon is string else '\U0000E2D5') if repeat_item_state_is_on else nextion.icons.blank }}" + message: "{{ repeat_item_icon }}" continue_on_error: true # {{ is_state(repeat.item.entity, 'on') | default(False) if repeat.item.entity is string else 'unavailable' }}