Supports icon from attributes for chips

This commit is contained in:
Edward Firmo
2023-04-13 14:20:29 +02:00
committed by GitHub
parent cfb076a01b
commit 5d523eabd6

View File

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