From 877dc316ffc27af58a5ba702fce9708e3e3f0222 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 12 Apr 2023 21:30:09 +0200 Subject: [PATCH] Fix button icon when unavailable (#660) Button pages will show a mdi:alert-circle when an entity is unavailable, just like before. --- nspanel_blueprint.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 9942dc0..decd7d6 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -2405,7 +2405,7 @@ variables: scene: "\U0000EE0B" #EE0B script: "\U0000F45D" #F45D switch: "\U0000E97D" #E97D - unknown: "\U00000E27" #E027 + unknown: "\U0000E027" #E027 weather: lightning: "\U0000E592" #E592 protect: "\U0000F05C" #F05C @@ -4435,7 +4435,12 @@ action: # BRIGHTNESS Font Color btn_bri_font: "{{ btn_txt_font }}" #"{{ nextion.colors.grey_dark }}" # ICON Value - btn_icon: "{{ repeat.item.icon if repeat.item.icon | length > 0 else nextion.icons.buttons[repeat.item.entity.split('.')[0] if repeat.item.entity else 'unknown'] }}" + btn_icon: > + {% if not current_entity_state_available %} {{ nextion.icons.buttons.unknown }} + {% elif repeat.item.icon | length > 0 %} {{ repeat.item.icon }} + {% elif repeat.item.entity and repeat.item.entity.split('.') | count > 1 %} {{ nextion.icons.buttons[repeat.item.entity.split('.')[0] if repeat.item.entity else 'unknown'] }} + {% else %} {{ nextion.icons.buttons.unknown }} + {% endif %} # LABEL Value btn_label: "{{ repeat.item.name }}" # BRIGHTNESS Value