Fix button icon when unavailable (#660)

Button pages will show a mdi:alert-circle when an entity is unavailable, just like before.
This commit is contained in:
Edward Firmo
2023-04-12 21:30:09 +02:00
committed by GitHub
parent 76abf9611d
commit 877dc316ff

View File

@@ -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