Supports icon from attributes for chips
This commit is contained in:
@@ -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' }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user