Support for icon from attributes on Entities pages
This commit is contained in:
@@ -4806,13 +4806,17 @@ action:
|
|||||||
then:
|
then:
|
||||||
- variables:
|
- variables:
|
||||||
repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}"
|
repeat_item_state: "{{ states(repeat.item.entity) | default('unavailable') }}"
|
||||||
- if: "{{ repeat.item.icon | length > 0 }}"
|
repeat_item_icon: >
|
||||||
|
{% if repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon) }}
|
||||||
|
{% elif state_attr(repeat.item.entity, 'icon') | default('') not in ['unavailable', 'unknown', '', None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, 'icon').split(':')[1]] | default(None) }}
|
||||||
|
{% endif %}
|
||||||
|
- if: "{{ repeat_item_icon is string and repeat_item_icon | length > 0 }}"
|
||||||
then:
|
then:
|
||||||
- *delay-default
|
- *delay-default
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
data:
|
data:
|
||||||
component: "{{ repeat.item.component }}_pic"
|
component: "{{ repeat.item.component }}_pic"
|
||||||
message: "{{ repeat.item.icon }}"
|
message: "{{ repeat_item_icon }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
- *delay-default
|
- *delay-default
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
- service: "{{ nextion.commands.text_printf }}"
|
||||||
@@ -5312,7 +5316,7 @@ action:
|
|||||||
##### Long Press Entity Name #####
|
##### Long Press Entity Name #####
|
||||||
entity_long_name: "{{ last_click_button.name }}"
|
entity_long_name: "{{ last_click_button.name }}"
|
||||||
##### Long Press Entity Icon #####
|
##### Long Press Entity Icon #####
|
||||||
entity_long_icon: "{{ nextion.icons.all[last_click_button.icon.split(':')[1]] | default(last_click_button.icon if last_click_button.icon is string else '\U0000E2D5') }}" # DEBUG #
|
entity_long_icon: "{{ nextion.icons.all[last_click_button.icon.split(':')[1]] | default(last_click_button.icon if last_click_button.icon is string else '\U0000E2D5') }}"
|
||||||
##### Long Press Entity Icon Color #####
|
##### Long Press Entity Icon Color #####
|
||||||
entity_long_icon_color: "{{ last_click_button.icon_color_rgb if is_number(last_click_button.icon_color_rgb) else ((last_click_button.icon_color_rgb[0] //(2**3)) *(2**11))+((last_click_button.icon_color_rgb[1] //(2**2)) *(2**5))+(last_click_button.icon_color_rgb[2] //(2**3)) }}"
|
entity_long_icon_color: "{{ last_click_button.icon_color_rgb if is_number(last_click_button.icon_color_rgb) else ((last_click_button.icon_color_rgb[0] //(2**3)) *(2**11))+((last_click_button.icon_color_rgb[1] //(2**2)) *(2**5))+(last_click_button.icon_color_rgb[2] //(2**3)) }}"
|
||||||
##### Current Page #####
|
##### Current Page #####
|
||||||
|
|||||||
Reference in New Issue
Block a user